[fpc-pascal] Resourcestrings in FPC 3.0

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Sep 24 09:28:28 CEST 2015


Martin Schreiber wrote:
> On Thursday 24 September 2015 08:42:11 Jonas Maebe wrote:
>> 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.

Well, I didn't implement either support for codepage-aware ansistrings 
(I just used it to fix the RTL file system interfaces) or for 
resourcestrings in the compiler, so it's pretty logical that I have no 
clue about this.

> I hope you understand my frustration. Now we have the overly complicated
> codepage aware ansistring which nobody uses,

At least the FPC RTL makes a lot of use of it internally, and it is very 
practical there to deal with the requirements of different platforms. In 
fact, without this functionality it was simply impossible to support 
shortstring and ansistring interfaces in the RTL for file system 
operations in a robust way. You may not have cared if we got rid of all 
those interfaces since you only use unicodestring, but a lot of people 
would have.

> not even Lazarus uses utf8string
> but sets default codepages to utf-8 instead  and Delphi removed it from the
> newer compilers already,

Delphi also removed support for mutable unicodestrings, I believe. We 
generally try to support everything, rather than removing things. That's 
obviously more work.

> 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.

There are several more, including lack of support for non-ansi encoded 
file names and most classes that (still) exist only in ansistring form. 
You can of course create replacements for all of that, but then again, 
you could also implement a replacement for resourcestrings in that case.

I'm not suggesting that this is what you should do, nor that FPC 
shouldn't support resourcestrings in arbitrary encodings or at least 
with a deducible encoding for external tools (since apparently external 
tools are supposed to be able to work with these generated files), but I 
don't think there's a fundamental difference between these cases. 
Standard Pascal IO routines are as much part of the language as 
resourcestrings are.

> Should I make a bug report?

There is already a (very old) bug report for that.

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

I think they should have the same effect.


Jonas



More information about the fpc-pascal mailing list