Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 8. Unicode > Item 73. Tell Perl which encoding to use

Item 73. Tell Perl which encoding to use

When you start using Unicode with your old-style programming habits, you’re probably going to see warnings about “Wide character in . . .,” where Perl isn’t expecting something more than ASCII but gets it anyway. It’s fairly easy to fix this. You just have to tell your filehandles what encoding they should expect. Even if you don’t see any warning, but your input or output appears to be corrupted, you have to pay attention to how you’re telling Perl to treat filehandles.

It’s not enough that Perl knows that you used Unicode directly in your program source. When it sends that data to something else, you also need to ensure that the next thing sees the data in the right encoding, too. Perl has to encode your data correctly so the next consumer of the data can decode them correctly.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial