Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-04

request for help: connecting to WIN1251 (ANSI) codepaged DB (FB1.0.3) in Lazarus

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

62mkv

Hello ,

when trying to connect to FB 1.0.3 server, to database that was created using WIN1251 (Windows Ansi Cyrillic) CHARSET, via SqlDB TIBConnection component, all Lazarus visual components display ASCII (32-127) characters OK, but all Cyrillic characters are displayed as ????

I cannot convert DB (anyway, FB 1.0.3 doesn't
support UTF8) or switch to using another FB.

I've made requests on several FreePascal\Lazarus forums, all states that I need either to migrate to migrate to more recent version of FB (most popular advice, which I cannot follow) or "patch" SqlDB components so that they should make on-the-fly AnsiToUTF8 and vice versa conversion

Please tell me, is it the only way, and if yes, than how to do it, more exactly, cause I'm a terribly new to Lazarus

Best wishes, 62mkv

mailto:

Joost van der Sluis
to 62mkv
62mkv wrote 13 lines
when trying to connect to FB 1.0.3 server, to database that was created using WIN1251 (Windows Ansi Cyrillic) CHARSET, via SqlDB TIBConnection component, all Lazarus visual components display ASCII (32-127) characters OK, but all Cyrillic characters are displayed as ???? I cannot convert DB (anyway, FB 1.0.3 doesn't support UTF8) or switch to using another FB. I've made requests on several FreePascal\Lazarus forums, all states that I need either to migrate to migrate to more recent version of FB (most popular advice, which I cannot follow) or "patch" SqlDB components so that they should make on-the-fly AnsiToUTF8 and vice versa conversion

Why didn't you try that? It's a proper solution.

Please tell me, is it the only way, and if yes, than how to do it, more exactly, cause I'm a terribly new to Lazarus

You can try to set the character-set of the FB-client when you connect. And you can be new to Lazarus, but this has nothing to do with Lazarus or fpc. It's a FB issue, or more general, a conversion to UTF issue.

Joost.

Felipe Monteiro de Carvalho
to Joost van der Sluis

Actually you should use CP1251ToUTF8 for the conversion from the unit LConvEncoding and not AnsiToUTF8 if you want your code to work properly in any computer.

AnsiToUTF8 will only correctly if CP1251 is your system encoding.

Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho
to 62mkv: when trying to connect to FB 1.0.3 server, to database that was created using WIN1251…

2010/4/1 62mkv :

 I've made requests on several FreePascal\Lazarus forums, all states  that I need either to migrate to migrate to more recent version of  FB (most popular advice, which I cannot follow) or "patch" SqlDB  components so that they should make on-the-fly AnsiToUTF8 and vice versa conversion

Another solution is not using data-aware controls, read your data directly from the database though your TDataset object and before sending the strings to Lazarus convert them using CP1251ToUTF8

Felipe Monteiro de Carvalho