Thread JSON und utf8 (25 answers)
Opened by rosti at 2018-05-06 18:58

Linuxer
 2023-05-14 16:13
#194877 #194877
User since
2006-01-27
3869 Artikel
HausmeisterIn

user image
Hier gibt JSON::to_json() das korrekt aus, ohne dass ich explizit utf8 abschalten muss.

Das Setting utf8 => 0 sollte default sein; siehe Modul-Dokumentation von CPAN:JSON.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
use strict;
use warnings;
use JSON;
use 5.010;

# enable terminal's utf8 for me
system("chcp 65001");

# UTF-8
my $h = { euro => pack("CCC", 226, 130, 172) };

say to_json($h);
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread JSON und utf8