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?


In reply to (Windows) Encode vs. use open by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.