[fpc-pascal] Resourcestrings in FPC 3.0

Martin Schreiber mse00000 at gmail.com
Thu Sep 24 09:10:06 CEST 2015


On Thursday 24 September 2015 08:42:11 Jonas Maebe wrote:
> Martin Schreiber wrote:
> > FPC fixes_3_0 with the program
> > "
> > program json;
> > {$codepage utf8}
> > {$ifdef FPC}{$mode objfpc}{$h+}{$endif}
> > {$ifdef mswindows}{$apptype console}{$endif}
> > uses
> >   {$ifdef FPC}{$ifdef unix}cthreads,cwstring,{$endif}{$endif}
> >   sysutils;
> > resourcestring
> >   a = 'aäÄ';
> > begin
> > end.
> > "
> > produces the file json.rsj
> > "
> > {"version":1,"strings":[
> > {"hash":7200948,"name":"json.a","value":"a\u00C3\u00A4\u00C3\u0084"}
> > ]}
> > "
> > Is this intended?
>
> I have no idea. I only looked at the compiler/cresstr.pas unit and saw
> that the codepage of resource strings stored in the object code is set
> to the source file code page. I don't even know how the .rst/.rsj files
> are used by the compiler or RTL (or external tools), and have never
> worked on this aspect of the compiler/RTL.
>
Ouch.
I hope you understand my frustration. Now we have the overly complicated 
codepage aware ansistring which nobody uses, not even Lazarus uses utf8string 
but sets default codepages to utf-8 instead and Delphi removed it from the 
newer compilers already, but we still have no full Unicode resourcestring 
environment which was the only missing piece in order to make comfortable 
Unicode applications since the implementation of widestring/unicodestring 
many years ago.
Should I make a bug report?

Another question, it looks to me that -Fcutf8 does not work like {$codepage 
utf8} for string constants. Is this intend?

Martin



More information about the fpc-pascal mailing list