Autor Beitrag
TiloS
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mo 18.09.06 11:12 
Hallo,

ich möchte einen Email-Header, der so aussieht:
Subject: =?iso-8859-1?B?/GJlcmbkbGxpZw==?=
in Delphi richtig darstellen.
Wie komme ich also von dem Ausdruck "GJlcmbkbGxpZw" zu dem richtigen Wort "überfällig", gibt es dafür irgendwo eine Funktion oder eine Umwandlungstabelle?

Vielen Dank im vorraus!
TiloS


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 18.09.2006 um 13:33
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 18.09.06 11:13 
Hast du es schon mit Unicode-fähigen Komponenten versucht?

_________________
Markus Kinzler.
TiloS Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mo 18.09.06 11:18 
Sind das spezielle Komponenten, bzw. woher könnte ich mir die besorgen?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 18.09.06 11:27 
Z.B. die TNT-Kompos

_________________
Markus Kinzler.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8553
Erhaltene Danke: 479

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 18.09.06 12:32 
Sicher, dass du da auf dem richtigen Weg bist? Die iso-8859-1-Darstellung von "Überfällig" ist nämlich "Überfällig". Mit Unicode hat das nichts zu tun - ISO-8859-1 ist einfach der Westeuropäische Zeichensatz, in weiten Teilen identisch mit Windows-1252...

_________________
We are, we were and will not be.
TiloS Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mo 18.09.06 12:54 
Der Email-Header in der exportierten MSG-Datei sieht zumindest so aus:
Subject: =?iso-8859-1?B?/GJlcmbkbGxpZw==?=
Im Email Programm TheBat wird dann der Betreff richtig mit "überfällig" angezeigt. Also muss es doch dafür einen Umwandlungsalgorithmus geben.

Ich hatt übrigens auch schonmal einen Header mit:
Subject: =?iso-8859-1?Q?Test_Auftr=E4ge=2C_=FCber_=D6sterreich?=
Diesen konnte ich dann mit einer ISO-8859-1 Tabelle umwandeln. Der Unterschied im Code ist hier aber das "B" und das "Q". Mit den obigen Zeichen kann ich wie gesagt gar nichts anfangen.

Gruß
TiloS
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 18.09.06 20:00 
ISI8895-1 ist der Zeichensatz, B\Q die Methode der Codierung ...
B = Base64 (Radix64) und Q = Quoted Printable ...

Schau Dir mal RFC821 an, dort solltest Du alles nötige finden.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
TiloS Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mo 25.09.06 09:11 
Titel: Lösung
Also die bisherigen Antworten haben mir nicht geholfen, ich habe aber jetzt im Netz eine Funktion gefunden, die für Delphi funktioniert:

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:
const
  Codes64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

function Encode64(S: string): string;
var
  i: Integer;
  a: Integer;
  x: Integer;
  b: Integer;
begin
  Result := '';
  a := 0;
  b := 0;
  for i := 1 to Length(s) do
  begin
    x := Ord(s[i]);
    b := b * 256 + x;
    a := a + 8;
    while a >= 6 do
    begin
      a := a - 6;
      x := b div (1 shl a);
      b := b mod (1 shl a);
      Result := Result + Codes64[x + 1];
    end;
  end;
  if a > 0 then
  begin
    x := b shl (6 - a);
    Result := Result + Codes64[x + 1];
  end;
end;


function Decode64(S: string): string;
var
  i: Integer;
  a: Integer;
  x: Integer;
  b: Integer;
begin
  Result := '';
  a := 0;
  b := 0;
  for i := 1 to Length(s) do
  begin
    x := Pos(s[i], codes64) - 1;
    if x >= 0 then
    begin
      b := b * 64 + x;
      a := a + 6;
      if a >= 8 then
      begin
        a := a - 8;
        x := b shr a;
        b := b mod (1 shl a);
        x := x mod 256;
        Result := Result + chr(x);
      end;
    end
    else
      Exit;
  end;
end;



Gruß
TiloS

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt