[fpc-devel] Unicodestring branch, please test and help fixing

ABorka fpc-devel at aborka.com
Fri Sep 12 20:36:42 CEST 2008


 > It is not documented at all. Just like the rest of the database-stuff.
 > But maybe I should write a FAQ for fpc. With the new lazarus-versions
 > using UTF-8 by default, this is asked quite often.

This would be really nice.

I know I'm not the only one who doesn't want to spend days on hacking 
and debugging the components and FCL code to find out why the database 
field values disappear/morf before reaching my program code when they 
didn't do it before. People will start using these new unicode based 
development tools and this problem will be there for all of them (and 
the problem is not only with the DBAware components but using a simple 
FieldByName....AsString and putting it into a normal control too).

A transparent solution would be the best - like FCL to do conversions 
back and forth automatically from the database codepage when asked to - 
but I guess that is too much to ask for. :) Maybe not even possible.

Thank you for the help guys. Ill try to dig up more info from the 
mailing list archives when I have time.


Joost van der Sluis wrote:
> Op vrijdag 12-09-2008 om 15:56 uur [tijdzone +0200], schreef Mattias
> Gärtner:
>> Zitat von Joost van der Sluis <joost at cnoc.nl>:
>>
>>> Op vrijdag 12-09-2008 om 13:22 uur [tijdzone +0200], schreef JoshyFun:
>>>
>>>> A> Thanks for pointing me to the Lazarus thread about this and the bug
>>>> A> report. Checked them.
>>>> A> But as I understand there is no solution available at the moment for
>>> this.
>>>> I had partially solved the problem using the handler "OnGetText" ?
>>>> (I'm not sure about the name) for each field which is somehow dirty
>>>> forcing a codepage to UTF8 conversion (in Lazarus you will find some
>>>> codepage<->UTF conversions available).
>>> I think that the original poster didn't looked very well in the
>>> archives, this solution is told here quite often.
>>>
>>>> A> I have a database that is not encoded utf8 (and it will never be because
>>>> A> other client programs are accessing it and their users do not want/need
>>>> A> to be converted to unicode). How do I get the field values into
>>>> A> FPC/Lazarus into a string variable? Right now the non-unicode strings
>>>> A> are returned as empty from a database field due to FCL conversion
>>> functions.
>>>> If you will need this as a fixed solution for this project maybe you
>>>> can think in create a new database unit file based in the current one
>>>> (change the name of course) with hardcoded UTF8 encoding from codepage
>>>> for each string once retrieved from the database. Take care about
>>>> string length as UTF8 ones will be equal or longer than the original
>>>> ones.
>>> You can just override one single method to do this. This is also told a
>>> few times on this list.
>> Maybe it is not documented at the right place?
> 
> It is not documented at all. Just like the rest of the database-stuff.
> But maybe I should write a FAQ for fpc. With the new lazarus-versions
> using UTF-8 by default, this is asked quite often.
> 
> Joost
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list