Problems with Codepage

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Ingmar
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.09.2006, 14:16

Problems with Codepage

Post by Ingmar »

Hi,

I have problems with German Umlaute (ÄÖÜ).

My environment: D7, ZEOS 6.5.1 alpha CVS as of 23/09/2005 and mySQL 4.1.13.

I understand that I can add a codepage to the TZconnection's properties, like ZConnection.Properties.Add ('Codepage=ISO8859_1');

As far as I know my db-server has no ISO8859_1 installed. Instead I can see codespages like latin1 (with collations latin1_bin, latin_general_ci, latin1_german_ci), utf8 (with collations uft8_bin, utf_general_ci, utf8_german_ci) and many others.

If I try to set Codepage=latin1_german_ci I get an EZSQLException "SQL error: unknown character set."
Setting Codepage=latin1 executes without errors, but does not show German Umlaute.

The same is true for utf8 resp. utf8_german_ci.

Has anybody an idea?

Thanks!
Ingmar
barko
Senior Boarder
Senior Boarder
Posts: 51
Joined: 07.09.2005, 13:13

Post by barko »

here are supported codepages:

NONE
ASCII
BIG_5
CYRL
DOS437
DOS737
DOS775
DOS850
DOS852
DOS857
DOS858
DOS860
DOS861
DOS862
DOS863
DOS864
DOS865
DOS866
DOS869
EUCJ_0208
GB_2312
ISO8859_1
ISO8859_2
ISO8859_3
ISO8859_4
ISO8859_5
ISO8859_6
ISO8859_7
ISO8859_8
ISO8859_9
ISO8859_13
KSC_5601
NEXT
OCTETS
SJIS_0208
UNICODE_FSS
WIN1250
WIN1251
WIN1252
WIN1253
WIN1254
WIN1255
WIN1256
WIN1257

firebird has build in all codepages from above... and solution for you: use windows codepages from client side...

it works for me with:

linux firebird server (database is on linux)
and windows firebird client (software is on windows workstation) for client side you need only one dll (fbclient.dll for win and libfbclient.so for lin)... in program directory and that's all...

I use WIN1250 on windows clients and ISO8559_2 for linux clients

maybe is for mysql same thing...don't know...
Ingmar
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.09.2006, 14:16

Post by Ingmar »

Hi Barko,

thanks for your reply and help. Unfortunately your solution might work for Firebird, but I do not know/find any *.dll like those you mentioned for mySQL.

Instead I tried commands like SET NAMES utf8 or SET CHARACTER_SET utf8 in order to pursuade mySQL to send/transform characters to my needs. But nothing worked out as hoped.

Anybody has another idea or suggestion?

Thanks!
Ingmar
Ingmar
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.09.2006, 14:16

Post by Ingmar »

Still have no solution for that. Doesn't anybody have an idea?
Thanks,
Ingmar
User avatar
dhongu
Junior Boarder
Junior Boarder
Posts: 37
Joined: 28.09.2005, 08:37
Location: Bucuresti
Contact:

Post by dhongu »

in my.ini set

#Set the default character set.
default_character_set=latin1

I try with (ÄÖÜ) and work.
Dorin Hongu
Ingmar
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.09.2006, 14:16

Post by Ingmar »

Hi Dorin,

this IS already the current setting in my.ini.
Both for Client and for server.

But maybe I have to be more precise:
The database is feeded by a webbased application (PHP). When I look in the database with Tools like phpMyAdmin I can see that Umlaute are stored correctly. But when I call my Delphi application (using ZEOS) I can not see the Umlaute.
On the other hand, if I add data (containing Umlaute) to the database with my Delphi tool, then I see the Umlaute with my Delphi app (of cource), but not in phpMyAdmin.

I'm using these settings in all PHP pages:

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
As far as I know, iso-8859-1 is the same as Latin1, so PHP and Delphi should use the same codepages...but who knows ;-)

Any more ideas what I could/should try?
maxs
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 24.11.2006, 18:44

Post by maxs »

Ingmar wrote:Still have no solution for that. Doesn't anybody have an idea?
For example

Code: Select all

procedure TZConnection.OnAfterConnect(Sender: TObject);
begin
  TZQuery.Close;
  TZQuery.SQL.Text := 'SET NAMES ''cp1251''';
  TZQuery.ExecSQL;
  TZQuery.Close;
  TZQuery.SQL.Text := 'SET CHARACTER SET cp1251';
  TZQuery.ExecSQL;
end;
All fine work.
Post Reply