[fpc-devel] Unicode resourcestrings

Martin Schreiber fpmse at bluewin.ch
Sun Mar 2 09:40:29 CET 2008


On Friday 29 February 2008 10.07:29 Daniƫl Mantione wrote:
> >
> > Ideally from my point of view would be if the resourcestrings are stored
> > in utf-8 if the unit is compiled with -Fcutf8 and decoded by utf8decode
> > for widestring assignment on runtime independent of the system encoding.
>
> This has been discussed before. Automatic conversion to/from ansistrings
> will always be to/from system encoding. If you want another encoding than
> the system encoding you will have to do a manual conversion.
>
> For the compiler, a resourcestring has the same type as an ansistring, so
> no distinction can be made between resourcestrings/ansistrings.
>
That means that the program must be compiled in the same system encoding as 
the target runs in order to get working resourcestrings? That would 
resourcestrings for i18n purposes render useless apart from utf-8-only or 
latin-1-only. utf-8-only is not possible for older existing installations.

The compiler does not know that the source is a resource string? But the 
compiler could know it, the information is available?
If the resourcestring kind of source is known, fpc_ResourceStr_To_WideStr 
could be called instead of fpc_AnsiStr_To_WideStr, the widestring manager 
needs an additional procedure Resource2WideMoveProc where the appropriate 
conversion takes place.

Martin




More information about the fpc-devel mailing list