Parent Directory | Revision Log
fix encoding in files with mixed UTF-8 and ISO-8859-1 encoding
1 | #!/usr/bin/perl |
2 | use strict; |
3 | use warnings; |
4 | |
5 | # slightly modified from http://plasmasturm.org/log/416/ |
6 | |
7 | use Encode qw( decode FB_QUIET ); |
8 | |
9 | binmode STDIN, ':bytes'; |
10 | binmode STDOUT, ':encoding(UTF-8)'; |
11 | |
12 | while ( <> ) { |
13 | while ( length ) { |
14 | my $out = ''; |
15 | $out .= decode( "utf-8", $_, FB_QUIET ); |
16 | $out .= decode( "iso-8859-1", substr( $_, 0, 1 ), FB_QUIET ) if length; |
17 | print $out; |
18 | } |
19 | } |
20 |
Name | Value |
---|---|
svn:executable | * |
ViewVC Help | |
Powered by ViewVC 1.1.26 |