22 jun 2006 kl. 20.29 skrev Tommy Nordgren:
22 jun 2006 kl. 20.15 skrev Sherm Pendley:
On Jun 22, 2006, at 1:48 PM, Tommy Nordgren wrote:
How do I write proper utf 8 characters to a file? I write only
two characters, and they come out as four
garbage characters when I view the file in an editor.
Quick answer:
open FH, ">:utf8", "file";
Complete answer:
perldoc perluniintro
perldoc PerlIO
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
I've already tried that. That was what i was doing when I got
garbage.
I found the problem it is necessary to
1) use the use utf8 pragma;
2) Explicitly write a BOM byte sequence immediately after opening the
file.
point 2 is where I erred. I expected the BOM to be added automatically,
when opening a file for write with the utf-8 encoding.
-------------------------------------
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
[EMAIL PROTECTED]