in reply to Converting UTF-16 files to UTF-8

It works for me in 5.8.8. It should work in 5.8.6 too.

>debug in File not found -e100 FF FE 01 14 01 14 01 14 -rcx CX 0000 :8 -w Writing 00008 bytes -q >perl 615796.pl in out >debug out -rcx CX 0009 : -d100 l9 137A:0100 E1 90 81 E1 90 81 E1 90-81 ......... -q

By the way, I've had problems with using :encoding(...) and multi-byte character sets. I recommend :raw:encoding(...), but keep in mind it has the side effect of not adding/removing a CR that preceeds a LF.

Replies are listed 'Best First'.
Re^2: Converting UTF-16 files to UTF-8
by almut (Canon) on May 17, 2007 at 11:52 UTC
    I recommend :raw:encoding(...), but keep in mind it has the side effect of not adding/removing a CR that preceeds a LF.

    Maybe it's worth mentioning (though it has nothing to do with the OP's problem) that - in some cases - you can work around this CR/LF issue by re-adding the Windows specific crlf PerlIO layer (which is being removed by :raw) in a different position in the layer stack, e.g.

    :raw:encoding(utf16le):crlf:utf8"

    as I described in more detail in this node.

Re^2: Converting UTF-16 files to UTF-8
by demerphq (Chancellor) on May 17, 2007 at 11:44 UTC

    Given that you are using debug this is on windows I assume... But which perl? An AS build?

    ---
    $world=~s/war/peace/g

      Yes

      This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 50 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 820 [274739] provided by ActiveState http://www.ActiveSta +te.com Built Jan 23 2007 15:57:46

      on WinXP Pro