On Jun 22, 2006, at 3:28 PM, Tommy Nordgren wrote:
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
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;
That's only needed if your actual Perl code is UTF-8 encoded, like my
example was. If your UTF-8 data is coming from an external source,
"use utf8" has no effect.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org