Page 1 of 1

[patch_done] PostgreSQL UTF8 Charset Patch R3 for 6.6.2 RC

Posted: 08.01.2008, 02:36
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.

Posted: 25.03.2008, 17:44
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

Patch does not work for text fields

Posted: 31.03.2008, 20:38
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.

Posted: 10.04.2008, 10:41
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.

Posted: 10.04.2008, 14:03
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.

Posted: 08.08.2008, 07:53
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.

Posted: 08.08.2008, 10:33
by cipto_kh
is this included in 6.6.3-stable version?

Posted: 08.08.2008, 12:13
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

Posted: 11.08.2008, 01:28
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.

Posted: 11.08.2008, 07:46
by whitekid
R5 version was posted. Please checkout!