Thread MIME::Lite Encoding Problem (34 answers)
Opened by andi25 at 2010-06-21 14:25

GwenDragon
 2010-06-21 15:05
#138607 #138607
User since
2005-01-17
14510 Artikel
Admin1
[Homepage]
user image
Wie sind denn deine Eingabedaten? Was für eine Kodierung haben die?

Verstehe ich dich richtig? Du willst, dass die Headerinhalte nach UTF-8 kodiert werden sollen?
Das leistet MIME::Lite nicht.

Das musst du mit Encode tun.
Code (perl): (dl )
1
2
3
4
5
use Encode qw/from_to/;
...
...

from_to($string, "cp850", "utf-8");


//EDIT:
Gerade getestet und folgendes Skript als ANSI-Datei erstellt:
Code (perl): (dl )
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
#!/usr/bin/perl

use strict;
use warnings;

use MIME::Lite;
use Encode qw(from_to);

my $subject = "TÄST";
my $from = "ÄÖÜ <a\@example.org>";
my $to = "lölölöß <b\@example.org>";
from_to($subject, "windows-1252", "utf-8"); 
from_to($to,  "windows-1252", "utf-8");
from_to($from, "windows-1252", "utf-8");

my $msg = MIME::Lite->new        (                
Subject => $subject,            
From    => $from,         
To      => $to,                  
Type    => 'multipart/mixed',                
Charset => 'utf-8'  );

open my $fh,"> m.msg"; # nur zum test!
$msg->print_header($fh);    
close $fh;

Das gibt dann eine Mailheaderdatei aus, die wirklich im Editor als UTF8 geöffnet, alles richtig hat.
Last edited: 2010-06-21 15:22:00 +0200 (CEST)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread MIME::Lite Encoding Problem