Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: utf8 writing

by Eliya (Vicar)
on Feb 20, 2011 at 22:21 UTC ( #889260=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $text = "\xCE\xA9";  # Omega, UTF-8 encoded
    
    ...
    
    open FH, ">:utf8", "myfile" or die $!;
    print FH $text;         # wrong: C3 8E C2 A9
    
  2. or download this
    use Encode;
    
    ...
    
    open FH, ">:utf8", "myfile" or die $!;
    print FH $text;         # OK
    
  3. or download this
    use Encode;
    
    ...
    
    open FH, ">:utf8", "myfile" or die $!;
    print FH $text;         # OK
    
  4. or download this
    my $text = "\xCE\xA9";
    
    ...
    
    open FH, ">", "myfile" or die $!;  # no PerlIO encoding layer
    print FH $text;         # OK
    
  5. or download this
    print "is Omega" if $text =~ /\x{03A9}/;    # doesn't match!
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-12-29 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls