On Mon, 4 Apr 2016, Tobias Giesen wrote:

Hello,

my application uses the AnsiString type to store UTF-8 data. That was
totally fine. Now in FPC 3, automatic conversions cause data loss. I
get question marks replacing Chinese characters, for example.

I do not fully understand at which points these conversions are done.
The FPC 3 Unicode documentation says something about "passing it to a
RTL routine".

What about this code:
var a,b:Ansistring;
begin
 a:=Utf8Encode(AWideString);
 b:=Copy(a,1,10);
 end;

Is "Copy" an RTL routine? Is this OK or not?

Best for me would be to be able to turn the conversions off completely.

You cannot, but you can set DefaultSystemCodePage to CP_UTF8.
Then no conversions will be done for all ansistrings that contain UTF8.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to