mirror of https://github.com/odrling/Aegisub
parent
1d3ec92627
commit
c22c36c687
|
@ -17,13 +17,13 @@ open(OUTFILE, ">:utf8", $outfile) or die("Can't open $outfile: $!");
|
||||||
|
|
||||||
# loop over lines in the infile
|
# loop over lines in the infile
|
||||||
while (<INFILE>) {
|
while (<INFILE>) {
|
||||||
for (split('', $_)) { # loop over characters in the line
|
for (split('', $_)) { # loop over characters in the line
|
||||||
my $cp = ord;
|
my $cp = ord;
|
||||||
if ($cp < 127 or $cp == 0xFFFE or $cp == 0xFEFF) { # is it a normal ASCII codepoint or a BOM?
|
if ($cp < 127 or $cp == 0xFFFE or $cp == 0xFEFF) { # is it a normal ASCII codepoint or a BOM?
|
||||||
print OUTFILE $_; # then pass through unchanged
|
print OUTFILE $_; # then pass through unchanged
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print OUTFILE "\\u", sprintf("%04x", $cp); # otherwise print as \uHEX
|
print OUTFILE "\\u", sprintf("%04x", $cp); # otherwise print as \uHEX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue