[fpc-devel] Unicode resourcestrings

Florian Klaempfl florian at freepascal.org
Sun Mar 2 18:43:01 CET 2008


Martin Schreiber schrieb:
> On Sunday 02 March 2008 15.31:04 Daniël Mantione wrote:
>>> Then the only possible way to use resourcestrings independent from the
>>> system encoding is to compile all resource units with -Fcutf8 and to
>>> write every assignment as "widestringvar:=
>>> Utf8Decode(resourceconstant);"?
>>> Would this method work?
>> Yes, that method would work.
>>
> Does not work for me, see attachment. Compiled with -Fcutf8 on win2000 
> with "ANSI" encoding.
> "
> const
>  strco1 = 'abcäöüûôõ';
>  strco2 = 'Русский';
>  strco3 = 'ABCDEFG';
> resourcestring
>  strco1res = 'abcäöüûôõ';
>  strco2res = 'Русский';
>  strco3res = 'ABCDEFG';
> 
> implementation
> uses
>  main_mfm;
>  
> procedure tmainfo.test(const sender: TObject);
> begin
>  di1.value:= '"'+strco1+'"';
>  di2.value:= '"'+strco2+'"';
>  di3.value:= '"'+strco3+'"';
>  di1res.value:= '"'+strco1res+'"';
>  di2res.value:= '"'+strco2res+'"';
>  di3res.value:= '"'+strco3res+'"';
>  di1resutf8.value:= '"'+utf8decode(strco1res)+'"';
>  di2resutf8.value:= '"'+utf8decode(strco2res)+'"';
>  di3resutf8.value:= '"'+utf8decode(strco3res)+'"';
> end;
> "
> What did I wrong?

I'am not sure how this could be made working just a remark: -Fcutf8
influences _only_ the interpretation of string constants when converting
them to unicode.



More information about the fpc-devel mailing list