[fpc-devel] utf8 in 2.6.0
Martin
lazarus at mfriebe.de
Tue Jan 1 15:14:27 CET 2013
On 01/01/2013 13:18, Jonas Maebe wrote:
> On 15 Dec 2012, at 19:35, Martin wrote:
>
>> 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 http://wiki.freepascal.org/LCL_Unicode_Support
>> I didnt find the fpc specific page, if exists (I suspect it does)
>>
>>
>> I am calling a function "function Foo(A:string)" {$mode objfpc}{$H+}
>> I call it with a constant, that contains an german umlaut. Checked with a hex editor, the constant in the source file is utf8
>>
>> - If I save the source (in utf8), without a utf8 BOM, then it works fine on windows.
>> - If I had a bom, then the string received by the function appears to be ascii (checked memory dump in debugger "oe" becomes d6
>> - if I add {$codepage utf8} it also becomes ascii
>>
>> 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.
>> If I add it things also go wrong, only different. Again no more info.
>>
>> -----------
>>
>> I know the provided info, is very little.
> There is not enough information to be able to give an answer. Source code, source code, source code.
>
Problem is, the original issue does not happen on my hardware.
It is about an issue with the test case in components/EditorMacroScript.
But only happens on powerPC hardware.
I only have/had an extract of the results. From the looks ofwhat went
wrong, and what was the output (calculating char positions) utf8 coding
was/is a strong suspect (not confirmed though.
On my hardware it is normally all fine, but fails if I add the
$codepage. I could spent a lot of work boiling that down to a sample.
But given that I couldn't even find the docs what I really should
expect, and therefore might be doing something wrong, I thought I go
first looking for what should happen.
Add {$codepage utf8}
on top of
lazarus\components\macroscript\test\testscriptprocs.pas
and the behaviour changes so that the test will fail. (there are utf8
constants in the source, and it appears, that with the $codepage the
called code does NOT get that utf8 string, but something else instead.
More information about the fpc-devel
mailing list