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!