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

ABorka fpc-devel at aborka.com
Fri Sep 12 02:30:35 CEST 2008


Hi,

Thanks for pointing me to the Lazarus thread about this and the bug 
report. Checked them.

But as I understand there is no solution available at the moment for this.

I have a database that is not encoded utf8 (and it will never be because 
other client programs are accessing it and their users do not want/need 
to be converted to unicode). How do I get the field values into 
FPC/Lazarus into a string variable? Right now the non-unicode strings 
are returned as empty from a database field due to FCL conversion functions.

Not to mention writing something to the database back.
Is there a function to convert 'My Perfect™ World®' to whatever format 
the components require and vice versa? Something for the ASCII table up 
till #255 (English letters with some special characters like the above 
example).


JoshyFun wrote:
> Hello ABorka,
> 
> Thursday, September 11, 2008, 7:26:50 PM, you wrote:
> 
> A> The database field can contain any string with '®' in it for this to happen
> A> for example: 'sometext®'
> A> It seems that
> A> ListBox1.Items.Add(SQL1.FieldByName('MyTableField').AsString);
> [...]
> A> will only put an empty string into the Listbox.
> A> Somewhere inside FCL, where the Listbox item is inserted there is a
> A> UTF8Decode which ends up with the empty string because of the '®'  #174
> A> character it thinks that it is a unicode encoded character and tries to
> A> get the additional bytes for it which ain't there.
> 
> http://bugs.freepascal.org/view.php?id=11791
> 
> A> Not sure how can this be circumvented (using some conversion function?)
> A> or if it is a bug.
> 
> Check Lazarus list, there is a quite recent thread about that "Unicode
> and DBAware" (is the text of the subject).
> 




More information about the fpc-devel mailing list