Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-12

Unicode

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Olaf Leidinger

Hello there!!!

Are there any functions to convert an ansi string to an unicode one.

Thanks in advance,

Olaf

Rimgaudas Laucius
to Olaf Leidinger
Hello there!!! Are there any functions to convert an ansi string to an unicode one.

MultiByteToWideChar

Here is function from Delphi for directly conversion. But it needs some changes for work with Free Pascal.

function StringToWideChar(const Source: string; Dest: PWideChar;
  DestSize: Integer): PWideChar;
begin
  Dest[MultiByteToWideChar(0, 0, PChar(Source), Length(Source),
    Dest, DestSize - 1)] := #0;
  Result := Dest;
end;