<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 15.12.2012 21:35, Martin wrote:
<blockquote cite="mid:50CCC30E.2020205@mfriebe.de" type="cite">I am
trying to figure out how to do that, or what I do wrong. I found a
page about $codepage, but it did not help
<a class="moz-txt-link-freetext" href="http://wiki.freepascal.org/LCL_Unicode_Support">http://wiki.freepascal.org/LCL_Unicode_Support</a>
<br>
I didnt find the fpc specific page, if exists (I suspect it does)
<br>
<br>
<br>
I am calling a function "function Foo(A:string)" {$mode
objfpc}{$H+}
<br>
I call it with a constant, that contains an german umlaut. Checked
with a hex editor, the constant in the source file is utf8
<br>
<br>
- If I save the source (in utf8), without a utf8 BOM, then it
works fine on windows.
<br>
- If I had a bom, then the string received by the function appears
to be ascii (checked memory dump in debugger "oe" becomes d6
<br>
- if I add {$codepage utf8} it also becomes ascii
<br>
<br>
If I do *not* add that, it seems something gos wrong with the
encoding on a PowerPC Mac. Unfortunately this is someone else's
pc, and I have no more info.
<br>
If I add it things also go wrong, only different. Again no more
info.
<br>
<br>
-----------
<br>
<br>
I know the provided info, is very little. If there is anything
obvious then tell me.
<br>
<br>
Thanks
<br>
_______________________________________________
<br>
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-devel">http://lists.freepascal.org/mailman/listinfo/fpc-devel</a>
<br>
</blockquote>
<font face="Liberation Sans"><br>
Probably this is due to significant change in FPC 2.7 RTL<br>
<br>
<b>String</b> type implies the encoding inside<br>
under WIndows it is ANSI by default.<br>
<br>
Try to write simple application that concatenates (s:=a+b) two
strings with umlauted letters.<br>
The resulting string loose the umlauts under Windows.<br>
<br>
The only thing that help at the RTL level - <br>
{$ifdef FPC}<br>
SetMultiByteConversionCodePage(CP_UTF8);<br>
{$endif}<br>
<br>
This brings similar behaviour for RTL functions ether in Windows
and UNIX but completely breaks file IO.<br>
You wont be able to open file which names translates to
more-than-one-byte per symbol.<br>
because RTL IO is ANSI-specific under Windows.<br>
<br>
Other approach - use the <b>UnicodeString</b>. Forget the <b>string</b>
type.<br>
<br>
regards,<br>
Anton<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font>
</body>
</html>