[fpc-pascal] Funny things about utf-8 strings on mac
Jeff Wormsley
daworm10 at comcast.net
Wed Jun 13 14:14:55 CEST 2007
What happens if you redefine your program as follows?
program utftestbom;
{$mode objfpc}{$H+}
uses SysUtils;
const MyStr: UTF8String = 'Texto ł ñ ø ß á';
var
i: Integer;
begin
WriteLn('Printing string values');
WriteLn('Length: ', Length(MyStr));
for i := 1 to Length(MyStr) do
Write(IntToHex(Integer(MyStr[i]), 2) + ' ');
WriteLn('');
end.
Felipe Monteiro de Carvalho wrote:
> On 6/13/07, Florian Klaempfl <florian at freepascal.org> wrote:
>> Then you have to use the utf8string type. If it doesn't work good
>> enough, we've to fix it.
>
> changing on my program from strint to utf8string didn't make any
> difference. The string is ok when I don't have BOM and is wrong with a
> BOM
>
> program utftestbom;
>
> {$mode objfpc}{$H+}
>
> uses SysUtils;
>
> var
> MyStr: UTF8String;
> i: Integer;
> begin
> MyStr := 'Texto ł ñ ø ß á';
>
> WriteLn('Printing string values');
>
> WriteLn('Length: ', Length(MyStr));
>
> for i := 1 to Length(MyStr) do
> Write(IntToHex(Integer(MyStr[i]), 2) + ' ');
>
> WriteLn('');
> end.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list