[fpc-pascal] Funny things about utf-8 strings on mac
jonas.maebe at elis.ugent.be
Tue Jun 12 20:31:47 CEST 2007
On 12 Jun 2007, at 11:41, Florian Klaempfl wrote:
>> Looks somewhat illogical to me ... so I write a UTF-8 string and need
>> a widestring managed? But I am not using widestrings ...
> You're. String constants containing chars > 127 are obviously as
> widestrings because when you give a code page in the source, you want
> another encoding then the system's default i.e. the compiler needs
> to remap.
>> And then it will convert the string to iso??
> ... or utf-8 ... depending on the setting of the system running the
This seems too limited to me, as you may be communicating with an API
that requires a different encoding than whatever is detected as
default. A Mac OS X GUI app does not execute any .profile or so, so
libiconv may very well default to some ISO encoding. That does not
mean that people converting widestrings to ansistrings want to use
this ISO encoding in all cases.
There's utf8encode/decode, but it's quite annoying if you have to
replace all widestring->ansistring assignments and parameter passing
code with that call (especially since the type conversion from
widestring to ansistring is supposed to do everything for you anyway).
More information about the fpc-pascal