Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: utf8 writing

by Eliya (Vicar)
on Feb 20, 2011 at 22:21 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://889260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-03-28 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found