12. Februar 2008
Delphi: UTF-8 / HTML => WideString
Nachdem ich keine Funktion gefunden hab die mir die Arbeit abnimmt, hab ich se eben selber geschrieben.
Tut folgendes: HTML Typen wie #323; (irgendein komisches Polnisches l mit strich
) in nen WideString umwandeln:
function Html2WideString(s: string): widestring; var i: integer; f: boolean; tmp: string; begin i := Pos('#', s); if i = 0 then begin Result := s; exit; end; f := false; Result := ''; tmp := ''; for i := 1 to Length(s) do begin if (s[i] = '&') then Continue; if (s[i] = '#') then begin f := true; Continue; end; if f and (s[i] = ';') then begin f := false; Result := Result + WideChar(StrToInt(tmp)); tmp := ''; Continue; end; if f then begin tmp := tmp + s[i]; Continue; end; Result := Result + s[i]; end; end;
lässt sich bestimmt noch optimieren, für mich reichts erstmal.
Update
Jetzt auch in Funktionierend