On 11/23/07, Ken Perl <[EMAIL PROTECTED]> wrote: > I use following piece of code to write smiley Unicode string > into a file, > > use Encode; > my $smiley = "\x{263a}"; > open my $out, ">:utf8", "file" or die "$!"; > print $out $smiley; > > however, if we dump the output file in binary mode, the hex looks > wrong, it isn't 263a, any idea what's wrong with the code? > > 0000000: e298 ba ...
I don't think anything is wrong with the code; you have a UTF-8 file. http://unicode.org/faq/utf_bom.html If you want a file to contain the hex value 263A, that's easy too: print $out "\x26\x3A"; Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/