Thread XML und Umlaute aus utf-8 (2 answers)
Opened by kami at 2012-02-01 17:01

GwenDragon
 2012-02-01 18:11
#155809 #155809
User since
2005-01-17
14533 Artikel
Admin1
[Homepage]
user image
Erklärung hier:
Quote
Data::Dumper doesn't restore the UTF8 flag; is it broken?

No, Data::Dumper's Unicode abilities are as they should be. There have been some complaints that it should restore the UTF8 flag when the data is read again with eval. However, you should really not look at the flag, and nothing indicates that Data::Dumper should break this rule.

Here's what happens: when Perl reads in a string literal, it sticks to 8 bit encoding as long as it can. (But perhaps originally it was internally encoded as UTF-8, when you dumped it.) When it has to give that up because other characters are added to the text string, it silently upgrades the string to UTF-8.

If you properly encode your strings for output, none of this is of your concern, and you can just eval dumped data as always.

Abhilfe bei den Perlmonks Perlmonks:820455
Last edited: 2012-02-01 18:26:33 +0100 (CET)
die Drachin, Gwendolyn


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

View full thread XML und Umlaute aus utf-8