Autor Beitrag
wazup
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 101

Windows XP
Delphi 2009
BeitragVerfasst: Fr 23.05.08 19:39 
Hallo...

Ich habe ein Problem mit dem umwandeln von:
ausblenden Quelltext
1:
2:
3:
4:
5:
 
¡
Ï
ù
und den weitern
und
ausblenden Quelltext
1:
2:
3:
4:
ü
ä
ö
und den weitern
Kann jemand helfen ?

Status: Ich weiß noch nicht einmal wie diese "Sachen" heißen :oops:
Aber ich weiß das es Zeichen sind

Danke für jede Antwort
cu, wazup


Zuletzt bearbeitet von wazup am Fr 23.05.08 21:45, insgesamt 1-mal bearbeitet
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 23.05.08 19:48 
Für die ersten paar Sachen solltest du dir mal StringReplace anschauen, das andere sieht mir sehr nach einer UTF8-Codierung aus, das kriegt man mit Utf8Decode oder Utf8ToAnsi hin.

Nebenbei: Den Titel könnte man etwas aufwerten - der ist so etwas seltsam. ;-)

_________________
We are, we were and will not be.
wazup Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 101

Windows XP
Delphi 2009
BeitragVerfasst: Do 05.06.08 11:34 
Falls jemand die lösung sucht:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
function Decode(const AText: UTF8String): WideString;
const
  List1: array [0..193] of string   = ('€', '', '‚', 'ƒ', '„', '…', '†', '‡',
                                       'ˆ', '‰', 'Š', '‹', 'Œ', '', 'Ž', '',
                                       '', '‘', '’', '“', '”', '•', '–', '—',
                                       '˜', '™', 'š', '›', 'œ', '', 'ž', 'Ÿ',
                                       ' ', '¡', '¢', '£', '¤', '¥', '¦',
                                       '§', '¨', '©', 'ª', '«', '¬', '­', '®',
                                       '¯', '°', '±', '²', '³', '´', 'µ',
                                       '¶', '·', '¸', '¹', 'º', '»', '¼',
                                       '½', '¾', '¿', 'À', 'Á', 'Â',
                                       'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É',
                                       'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð',
                                       'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×',
                                       'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ',
                                       'ß', 'à', 'á', 'â', 'ã', 'ä', 'å',
                                       'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì',
                                       'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó',
                                       'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú',
                                       'û', 'ü', 'ý', 'þ', 'ÿ', '─', '│',
                                       '┌', '┐', '└', '┘', '├', '┤',
                                       '┬', '┴', '┼', 'α', 'β', 'γ', 'Δ',
                                       '∑', '√', '∫', '≈', '≠', '≤',
                                       '≥', '←', '↑', '→', '↓', '↔',
                                       '↕', '•', '⁄', '‰', '™', '€',
                                       '─', '│', '┌', '┐', '└', '┘', '├',
                                       '┤', '┬', '┴', '┼', 'α', 'β', 'γ',
                                       'Δ', '∑', '√', '∫', '≈', '≠', '≤',
                                       '≥', '←', '↑', '→', '↓', '↔', '↕',
                                       '•', '⁄', '‰', '™', '€');

  List2: array [0..193] of WideChar = ('€', '�', '‚', 'ƒ', '„', '…', '†', '‡',
                                       'ˆ', '‰', 'Š', '‹', 'Œ', '�', 'Ž', '�', '�', '‘', '’', '“', '”', '•', '–', '—',
                                       '˜', '™', 'š', '›', 'œ', '�', 'ž', 'Ÿ', ' ', '¡', '¢', '£', '¤', '¥', '¦', '§',
                                       '¨', '©', 'ª', '«', '¬', '­', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·',
                                       '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç',
                                       'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×',
                                       'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç',
                                       'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷',
                                       'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', '─', '│', '┌', '┐', '└', '┘', '├', '┤',
                                       '┬', '┴', '┼', 'α', 'β', 'γ', 'Δ', '∑', '√', '∫', '≈', '≠', '≤', '≥', '←', '↑',
                                       '→', '↓', '↔', '↕', '•', '⁄', '‰', '™', '€', '─', '│', '┌', '┐', '└', '┘', '├',
                                       '┤', '┬', '┴', '┼', 'α', 'β', 'γ', 'Δ', '∑', '√', '∫', '≈', '≠', '≤', '≥', '←',
                                       '↑', '→', '↓', '↔', '↕', '•', '⁄', '‰', '™', '€');
var
  I: Integer;
  Q: string;
  C: Char;
begin
  Result := AText;

  { '%20', '%21', '%22' etc... }
  for I := 1 to Length(Result) do
  begin
    Q := Result[I] + Result[I + 1] + Result[I + 2];

    if (Q[1] = '%') and (Q[2] in ['0'..'9', 'A'..'F']) and (Q[3] in ['0'..'9', 'A'..'F']) then
    begin
      C := Chr(StrToInt('$' +  Q[2] + Q[3]));
      Result := StringReplace(Result, Q, C, [rfReplaceAll]);
    end;
  end;

  { '€', '', '‚' etc... }
  for I := 0 to 193 do
    Result := StringReplace(Result, List1[I], List2[I], [rfReplaceAll]);

  { Ã¼, Ã¤, Ã¶ etc... }
  for I := 1 to Length(Result) do
  begin
    Q := Result[I] + Result[I + 1];
    if (Utf8ToAnsi(Q) <> '') and (Utf8ToAnsi(Q)[1] <> ' ') then
    begin
      C := Utf8ToAnsi(Q)[1];
      Result := StringReplace(Result, Q, C, [rfReplaceAll])
    end;
  end;
end;