<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 30.03.2016 um 21:46 schrieb Graeme Geldenhuys:<br>
<blockquote cite="mid:56FC2CF9.9060202@geldenhuys.co.uk" type="cite">
<pre wrap="">Just thought I would let you know that with or without the {$codepage
utf8}, your code works just fine here. Source code is saved in a UTF-8
encoding with no BOM marker.
========================================================
[tmp]$ fpc test.pas
Free Pascal Compiler version 3.0.0 [2015/11/16] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
[tmp]$ ./test
DefaultSystemcodePage = 0
TestUtf8 = C38441C384
S1 = C38441C384 [0]
ÄAÄ
[.... adding $codepage and testing again.....]
[tmp]$ fpc test.pas
Free Pascal Compiler version 3.0.0 [2015/11/16] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
[tmp]$ ./test
DefaultSystemcodePage = 0
TestUtf8 = C38441C384
S1 = C38441C384 [65001]
ÄAÄ
========================================================
Regards,
- Graeme -
</pre>
</blockquote>
I've tested the example too and I got different results with
different options. The test was:<br>
- BOM / no BOM at the beginning of the sourcefile<br>
- {$codepage UTF8} or not<br>
- fpc -MObjFPC <b>-Sh</b> test.pas (with / without -Sh (use
reference counted strings))<br>
<br>
<br>
The results:<br>
<br>
with BOM / with defined codepage / no -Sh,<br>
no BOM / with defined codepage / no -Sh,<br>
no BOM / no defined codepage / no -Sh:<br>
<br>
DefaultSystemcodePage = 1252<br>
TestUtf8 = C3 84 41 C3 84<br>
S1 = C4 41 C4 [1252]<br>
ÄAÄ<br>
<br>
<br>
with BOM / with defined codepage / with -Sh,<br>
no BOM / with defined codepage / with -Sh,<br>
no BOM / no defined codepage / with -Sh:<br>
<br>
DefaultSystemcodePage = 1252<br>
TestUtf8 = C3 84 41 C3 84<br>
S1 = C3 84 41 C3 84 [65001]<br>
ÄAÄ<br>
<br>
<br>
with BOM / no defined codepage / with -Sh:<br>
<br>
DefaultSystemcodePage = 1252<br>
TestUtf8 = C3 84 41 C3 84<br>
S1 = C3 84 41 C3 84 [0]<br>
Ã"AÃ"<br>
<br>
<br>
with BOM / no defined codepage / no -Sh:<br>
<br>
DefaultSystemcodePage = 1252<br>
TestUtf8 = C3 84 41 C3 84<br>
S1 = C3 84 41 C3 84 [1252]<br>
ÄAÄ<br>
<br>
<br>
So it is realy more complex as I thought...<br>
<br>
As a résumé I would say a UTF-8 encoded file with a BOM and not
setted {$codepage UTF8} is a showkiller here (Windows7, FPC 3.1.1,
Lazarus 1.7).<br>
<br>
If somebody is interested, the testfiles/-results are added.<br>
<br>
Regards<br>
<br>
Michl<br>
</body>
</html>