Mi, 30.03.05 0:44 c:\>cat trans-encode.pl
use strict;
use diagnostics;
use Encode 'from_to';
while (<>) {
from_to($_, "shiftjis", "utf8");
print;
};
Mi, 30.03.05 0:44 c:\>cat trans-useopen.pl
use strict;
use diagnostics;
use open IN => ':encoding(shiftjis)', OUT => ':utf8';
while (<>) {
print;
};
Mi, 30.03.05 0:45 c:\>cat sakura_5light.bms
*---------------------- HEADER FIELD
#PLAYER 1
#GENRE JP-SPIRITUAL POP
#TITLE ì¸ëÃîà [5key Light]
#ARTIST AKITO
#BPM 138
#PLAYLEVEL 3
#RANK 3
#TOTAL 0
#STAGEFILE title.bmp
%EMAIL
%URL
Mi, 30.03.05 0:45 c:\>perl trans-encode.pl < sakura_5light.bms > s.ut
+x
Mi, 30.03.05 0:46 c:\>cat s.utx
*---------------------- HEADER FIELD
#PLAYER 1
#GENRE JP-SPIRITUAL POP
#TITLE µÃ£ÃÃ
»µ£ê [5key Light]
#ARTIST AKITO
#BPM 138
#PLAYLEVEL 3
#RANK 3
#TOTAL 0
#STAGEFILE title.bmp
%EMAIL
%URL
Mi, 30.03.05 0:46 c:\>rem this above is correct
Mi, 30.03.05 0:47 c:\>perl trans-useopen.pl < sakura_5light.bms > s.u
+tx
Mi, 30.03.05 0:48 c:\>cat s.utx
*---------------------- HEADER FIELD
#PLAYER 1
#GENRE JP-SPIRITUAL POP
#TITLE ì¸ëÃîà [5key Light]
#ARTIST AKITO
#BPM 138
#PLAYLEVEL 3
#RANK 3
#TOTAL 0
#STAGEFILE title.bmp
%EMAIL
%URL
Mi, 30.03.05 0:48 c:\>rem it is passed through unchanged
Mi, 30.03.05 0:48 c:\>perl -v|head -9
This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
Binary build 811 provided by ActiveState Corp. http://www.ActiveState.
+com
ActiveState is a division of Sophos.
Built Dec 13 2004 09:52:01
I also tried with :encoding(utf8) instead of plain :utf8, but this didn't matter.
Sample file in uuencode (Total Commander can unpack this):
begin 644 sakura_5light.bms
M#0HJ+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2!(14%$15(@1DE%3$0-"B-03$%9
M15(@,0T*(T=%3E)%($I0+5-025))5%5!3"!03U`-"B-4251,12"-]XG8C(X@
M6S5K97D@3&EG:'1=#0HC05)425-4($%+251/#0HC0E!-(#$S.`T*(U!,05E,
M159%3"`S#0HC4D%.2R`S#0HC5$]404P@,`T*(U-404=%1DE,12!T:71L92YB
6;7`-"B5%34%)3"`-"B554DP@#0H-"@``
`
end
sum -r/size 10317/202
So simple question: why doesn't use open work as documented?