On 09 Sep 2009, at 21:10, Joao Morais wrote:

The following cgi script shows "??" in the browser if cwstring is
declared, and works as expected if the declaration is removed. Is
there something I can change in order to work with widestrings,
cwstring and special chars? fixes_2_4 with linux.

a) bug: you are not specifying to the compiler in what code page the strings in your source code are encoded. As a result, the compiler will assume it's the default (8859-1), unless their is an UTF-8 BOM (in which case the compiler parses it as UTF-8) b) when you use cwstring, the RTL will convert any widestring you write to the current locale. Under *nix this is defined by the "LANG" environment variable (which in turn controls the various LC_* environment variables). If the current locale does not support the character you try to write, you will get question marks.

I guess what's happening if you don't use cwstring and don't specify a code page, that the compiler dumps the character as it appears in the source code straight into the widestring without any conversion, and that the rtl later on extracts it (when "converting" from widestring to ansistring) also without any conversion. So it only happens to work because the code page in which you wrote the source code happens to be the same as the code page that the browser at the other side uses as default.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to