[fpc-pascal] Funny things about utf-8 strings on mac

Daniël Mantione daniel.mantione at freepascal.org
Wed Jun 13 13:42:26 CEST 2007



Op Wed, 13 Jun 2007, schreef Felipe Monteiro de Carvalho:

> 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.

How hard is it to add that widestringmanager? Correct version of this 
program:

program utftestbom;

{$mode objfpc}{$H+}

uses SysUtils,cwstring;

var
  MyStr:ansistring;
  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.

Daniël


More information about the fpc-pascal mailing list