Browse Subversion Repository
Contents of /trunk/installer/utf8_to.pl
Parent Directory
| Revision Log
Revision 8445 -
( show annotations)
( download)
( as text)
Tue Dec 17 12:15:31 2019 UTC
(4 years, 5 months ago)
by doda
File MIME type: text/x-perl
File size: 338 byte(s)
Merge branch 'unicode_buf'
| 1 |
use utf8; |
| 2 |
|
| 3 |
my $code = $ARGV[0]; |
| 4 |
my $in = $ARGV[1]; |
| 5 |
my $out = $ARGV[2]; |
| 6 |
|
| 7 |
open(INP, "<:raw:utf8", $in) or die("error :$! $in"); |
| 8 |
open(OUT, ">:raw:encoding($code)", $out) or die("error :$! $out"); |
| 9 |
|
| 10 |
my $line = 1; |
| 11 |
while (<INP>) { |
| 12 |
if ($line == 1 && $code !~ /utf/) { |
| 13 |
# remove BOM |
| 14 |
s/^\x{FEFF}//; |
| 15 |
} |
| 16 |
print OUT; |
| 17 |
$line++; |
| 18 |
} |
|