That's why I also can't use 'ansirightstr' in LZR/FPC.
http://www.lazarus.freepascal.org/index.php/topic,11054.0.html
Is LZR/FPC use only UTF-8?
FPC uses the encoding of the system. There is a small problem under Windows, because there there are three default encodings:
- OEM encoding for the textmode console
- ansi encoding for most 1-byte API functions (can be UTF-8, but typically isn't)
- 2-byte API functions (the so called "wide" or -W functions) API
In general
FPC uses the ansi encoding on Windows, and inserts oem2ansi conversions where necessary. It also usually calls the 1-byte -A API functions.
Lazarus assumes all 1-byte strings (ansistring) contain UTF-8. This means ansi input from the system needs to be converted. (and the same for OEM, but textmode console is less important for Lazarus, moreover FPC units already abstract that)
Lazarus (probably) tries to use 2-byte -W functions as much as possible, but utf-8 can be converted into 2 byte UTF-16 without information loss.
Older Delphi's (till and including D2007) are like FPC. Assume default ansi encoding.
Newer Unicode Delphi's (Delphi 2009 and beyond) are nearly entirely 2-byte in everything. Moreover, they allow to attach the encoding (UTF-8, default ansi or OEM) to ansistrings so that conversions are done automatically when properly typed.
A project to implement such functionality (as in D2009+) in FPC has started but is stalled.