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

Joost van der Sluis joost at cnoc.nl
Fri Sep 12 16:09:57 CEST 2008


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




More information about the fpc-devel mailing list