Page 1 of 1

[solved] Spanish accents

Posted: 13.06.2012, 08:58
by skaw
Hi

when i do an

insert into t_persons (name) values ('áéíóú');

i got an

insert into t_persons (name) values ('áéíóú');

on

function TZPostgreSQLStatement.ExecuteUpdate(const SQL: string): Integer;
var
QueryHandle: PZPostgreSQLResult;
ConnectionHandle: PZPostgreSQLConnect;
begin
Result := -1;
ConnectionHandle := GetConnectionHandle();
{$IFDEF DELPHI12_UP}
QueryHandle := FPlainDriver.ExecuteQuery(ConnectionHandle,
PAnsiChar(UTF8String(SQL)));
{$ELSE}
....

due the UTF8String(SQL) statement. When i replace the

QueryHandle := FPlainDriver.ExecuteQuery(ConnectionHandle,
PAnsiChar(UTF8String(SQL)));

in TZPostgreSQLStatement.ExecuteUpdate function by

QueryHandle := FPlainDriver.ExecuteQuery(ConnectionHandle,
PAnsiChar(ansistring(SQL)));

i get it solved... but i dont like to modify sources directly....

Is there a elegant solution?... i try to use CODEPAGE=utf8 but it doesnt work...

Best regards :roll:

Posted: 13.06.2012, 09:22
by EgonHugeist
skaw,

Yes there is one. Just look here http://zeos.firmos.at/viewtopic.php?t=3427 and download my branch. Then set ZConnection.ClientCodePage=utf8 and ZConnection.PreprepareSQL=True and it should work like you want to have it...

Michael

Posted: 13.06.2012, 09:40
by skaw
Wow...!!!

worked really fine!!! good work!!!

will you merge with oficial trunk???

best regards
skaw

Posted: 13.06.2012, 09:59
by EgonHugeist
skaw,

That's what i want, logical. But not to be decided yet. I need some more happy people on my branch, i think. I know exactly what i'm doing there but it is another way then the trunk and testing goes. And it does exists since february 2012 and the other two branches over 5 years..

Btw. My branch does also support ANSI encoding. If your default encoding is not Unicode, then you can also chose your ANSI characterset. Or left the ClientCodePage empty and i switch always to the default one..

Enjoy, Michael