[fpc-devel] Unicode and Lazarus

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri Nov 21 10:35:54 CET 2008


On Fri, Nov 21, 2008 at 7:30 AM, Florian Klaempfl
<florian at freepascal.org> wrote:
> This is easily said, please create examples and descriptions how fully
> working is defined.

// Should actually convert from widestring to utf-8 when using encoding utf-8
programa utf8test1;

{$encoding utf-8} // or is it utf8?

var
  Str: UTF8String;
begin
  Str := "ção";
  if Length(Str) = 5 then Success
  else Fail;
end;

// Should work on all platforms. Passing the UTF8String to a routine
that requires
// ansistring should do the proper conversion
programa utf8test2;

{$encoding utf-8} // or is it utf8?

var
  Str: UTF8String;
begin
  Str := "ção";
  WriteLn(Str);
end;

-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list