[fpc-pascal] Funny things about utf-8 strings on mac

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Jun 13 01:33:50 CEST 2007


My current understanding of the issue is this:

I don't tell fpc how my file is encoded, so it suposes it's latin iso.
Then fpc detects the encoding of the operating system, and it sees
that it's also latin iso, so no convertion is necessary.

I suppose that if a different operating system encoding was found, fpc
would, at run-time, convert my string, but I don't really want that, I
would like to always get a UTF-8 string.

This is probably a good behavior for console applications, and maybe
applications written for gtk 1 too, where the expected encoding is the
one of the system.

But if I am using for example Gtk 2, or LCL, or fpGUI, or Carbon, or
many other libraries, I will want to always pass a UTF-8 string,
regartless of the encoding of the operating system.

How would I then be sure that my string is never converted (or always
converted from utf-8 to utf-8 if prefered), but just passed like I
wrote it to the library that I am using?

In the current situation, it seams to me that the output of my
software would be influenced by factors like changing the
implementation of the mac rtl so it starts detecting utf-8 (or
anothing different then latin iso) as the system encoding, or by using
a c widestring manager to do something unrelated.

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list