[fpc-devel] new string - question on usage

Martin lazarus at mfriebe.de
Mon Oct 10 19:12:55 CEST 2011


With fpc trunk strings are now codepage aware.

I currently face the issue, that lot's of old code just use "var foo: 
string". or sometimes explicit "ansistring". No idea what encoding that 
stores, put it does not seem to be utf8.

If I pass such a string (which contains utf8, but seems not to be marked 
as such) to a function declared as
   function Bar(val: Utf8String): Utf8String;
then I can see that it gets converted (which of course renders the data 
completely broken).

Now until I can convert all the strings to Utf8String, and until I can 
test all of that.... I need some work around for the very few places 
where such a call happens.

Is there a way to pass the string as argument but to suppress conversion 
(but keep the function declaration as it is with utf8string)?




More information about the fpc-devel mailing list