[patch_done] PostgreSQL UTF8 Charset Patch R3 for 6.6.2 RC

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

[patch_done] PostgreSQL UTF8 Charset Patch R3 for 6.6.2 RC

Post by whitekid »

Prior version(R2) has problem on TEXT type column handling.

Now TEXT column mapped to TWideMemoField.
and It will be applied to 6.6.2-RC

You need to set TZConnection.Options to use utf8 encoding

Code: Select all

codepage=utf8
client_encoding=utf8
Thanks.
You do not have the required permissions to view the files attached to this post.
wjmiller52
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 21.09.2007, 17:35

Post by wjmiller52 »

I have just tried this patch in a small test project, and it seems to fix all my problems except one -- if I try to add a SQL statement that uses a UTF character to the SQL strings of a query object, when I activate the query I get an error. If I use the same character in a filter, it works correctly with no problem.

I can get around the SQL problem by using the AnsiToUTF8 function, but it seems like it ought to be able to work without doing this, since the filter will work.

Thank you so much for this patch!! It is a HUGE help! I just wanted to point out the one remaining problem so you could make it absolutely perfect.
Thanks again
Bill
JKai
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 31.03.2008, 20:08

Patch does not work for text fields

Post by JKai »

The 6.6.2 patch works fine for varchar fields, but text fields do not work AT ALL now. Only one character seems to get into the text field.

I did not check the code before the patch to see if text fields worked correctly then.

The problem seems to be in the zdbcPostgreSQLStatement module around line 350 where it is encoding the unicode string from the stream. If I try to put a string like 'abc' into a text field, TempBlob.GetString gives "'a'#0'b'#0'c'#0" and the EncodeString returns "a\000b\000c\000". It seems to take "\000" as the end of the string, so when I look at the data in the field in pgAdminIII all that is there is "a". So I think the escape character encoding that is being used is bad for the data it gets from the stream. Do the 0s really have to be included in the encoding? It seems like they really ought to be skipped.

If I try to put a string like "a£a" in, I get an error because it does not like the "£".

I really need a couple of fields with unlimited text length. What can I do?

I have the codepage and client_encoding set to utf8 in the connection properties.
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

Post by whitekid »

Thanks JKai for review this patch!!

I was fixed the problem already. but forgot to post at this forum(^^; I'm lazy man..)

see http://zeos.firmos.at/viewtopic.php?t=1808 for patch r4 release or just go http://whitekid.tistory.com/18 and click zeos.utf8.6.6.2-rc.patch.r4 link to download patch

Thanks.
JKai
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 31.03.2008, 20:08

Post by JKai »

Thanks so much for your new version of the patch!

I tried it once using "£" (which caused errors before) and it worked fine.

Your patch is much more elegant and black belt than the hack I came up with. Since you are Korean I assume you have tested it extensively with Korean characters, which also increases my level of confidence in the patch a LOT.
Andrew K.
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 08.08.2008, 07:43
Contact:

Post by Andrew K. »

Hi! Please write me. Where define TWideMemo class?
I patching 6.6.3, but where compiling src have error: [Error] ZDatasetUtils.pas(321): Undeclared identifier: 'ftWideMemo'.
Maybe patching only work on the 6.6.2rc version? But I not found defined TWideMemo class inside.
User avatar
cipto_kh
Senior Boarder
Senior Boarder
Posts: 83
Joined: 28.09.2005, 11:22
Location: Indonesia
Contact:

Post by cipto_kh »

is this included in 6.6.3-stable version?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

No. If it was there would be a 'check mark icon' in the post title.

I can't find ftWideMemo in D7 help. Does anybody know since what Delphi and Fpc/Lazarus version this field type exists? (I see it's present in fpc 2.2.0)

As Delphi 7 is still commonly used we can't include the patch 'as is'. Anybody feels like correcting the patch to take this into account? Testing branch is 'available' now... I commit as soon as I get it compiled in D7 and Lazarus. If nobody does correct the patch, it will take longer to get in... but we'll have a look at it in due time.

Mark
Image
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

Post by whitekid »

Patch R4 will be acceptable on 6.6.3 Stable. but you patch it by your hand :D.

I testing patch for 6.6.3 Stable now. after the test new patch for 6.6.3 stable will be posted! Please wait.
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

Post by whitekid »

R5 version was posted. Please checkout!
Post Reply