ascii-only: safely handle non-unicode characters

This commit is contained in:
Vincent Riquer 2013-11-20 22:00:43 +01:00
parent 3d715ef18e
commit 64906e2ffb

View File

@ -4,11 +4,12 @@ ascii() {
coproc toascii { coproc toascii {
perl -e ' perl -e '
use utf8; use utf8;
use Encode;
use Text::Unidecode; use Text::Unidecode;
use open qw(:std :utf8); use open qw(:std :utf8);
$| = 1; $| = 1;
while (<>) { while (<>) {
print(unidecode($_)); print(unidecode(encode("utf-8", $_)));
}' }'
} }
} }