<?xml version="1.0" encoding="windows-1252"?>
<node id="868498" title="Re^2: Chicanery Needed to Handle Unicode Text on Microsoft Windows" created="2010-10-30 15:07:26" updated="2010-10-30 15:07:26">
<type id="11">
note</type>
<author id="546548">
Jim</author>
<data>
<field name="doctext">
&lt;p&gt;Thank you, ++ikegami. I understand your explanation just enough to trust that&lt;/p&gt;

&lt;code&gt;
:raw:perlio:encoding(UTF-16LE):crlf
&lt;/code&gt;

&lt;p&gt;is the best, right way to handle Unicode text in Perl on Windows.&lt;/p&gt;

&lt;p&gt;Should one use the same layers in the same order for both input &lt;i&gt;and&lt;/i&gt; output? Also, do you know why it doesn't work with the open pragma?&lt;/p&gt;

&lt;p&gt;I think you and others understand the point I'm making. If your text file is 40 years old and not EBCDIC, then it's ASCII, and writing a Perl script to handle it is easy. You're not forced to think about the character encoding of the text at all. But if you created the text file just now using Microsoft Notepad, writing a Perl script to do &lt;i&gt;anything&lt;/i&gt; useful with the text in the file is beyond the capabilities of a neophyte Perl programmer. No one new to the language could arrive at this exceedingly arcane solution to the &lt;i&gt;problem&lt;/i&gt; of handling a simple Unicode text file by reading any of the Perl documentation, especially PerlIO, or any books about the language. (PerlIO is incomprehensible to anyone who doesn't already know everything it documents.)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;UPDATE:&lt;/b&gt; The expert Perl programmers addressing [href://http://stackoverflow.com/questions/2626786/why-read-in-utf-16le-file-wont-convert-r-n-into-n-in-windows|this same problem at Stack Overflow] never arrived at the correct solution proffered here.&lt;/p&gt;
</field>
<field name="root_node">
868428</field>
<field name="parent_node">
868489</field>
</data>
</node>
