Thema: Delphi Wort und Umlaute etc...

Einzelnen Beitrag anzeigen

Bauer007

Registriert seit: 17. Sep 2007
Ort: Husum
56 Beiträge
 
Delphi XE2 Professional
 
#15

Re: Wort und Umlaute etc...

  Alt 18. Jan 2008, 11:38
meine gefundene Lösung (nachdem ich dann wusste wonach ich suchen kann hier im Forum) ist das hier:

Delphi-Quellcode:
function StringToWideStringEx(const S: string; CodePage: Word): WideString;
var
  InputLength,
    OutputLength: Integer;
begin
  InputLength := Length(S);
  OutputLength := MultiByteToWideChar(CodePage, 0, PChar(S), InputLength, nil, 0);
  SetLength(Result, OutputLength);
  MultiByteToWideChar(CodePage, 0, PChar(S), InputLength, PWideChar(Result), OutputLength);
end;

function WideStringToStringEx(const WS: WideString; CodePage: Word): string;
var
  InputLength,
    OutputLength: Integer;
begin
  InputLength := Length(WS);
  OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, nil, 0, nil, nil);
  SetLength(Result, OutputLength);
  WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, PChar(Result), OutputLength, nil, nil);
end;


function UTF8ToWideString(const S: string): WideString;
begin
  Result := StringToWideStringEx(S, CP_UTF8);
end;

function WideStringToUTF8(const WS: WideString): string;
begin
  Result := WideStringToStringEx(WS, CP_UTF8);
end;

Ist deinem sehr ähnlich
Sebastian
  Mit Zitat antworten Zitat