Summary
In this chapter, we looked at Perl’s support for character encodings and Unicode in particular. We saw how Perl implements wide characters, how to handle strings and filehandles that are widecharacter enabled, and how to convert between Unicode and other native character encodings. We also looked at Unicode character names and querying the Unicode database for details of blocks, scripts, and character properties.
We then turned to the subject of localization, or L10N, and locales, collections of related contextual information that describe the preferred character set of different languages and locations; the preferred local format of dates, times, and numbers; the name of the local currency; names of days and months; and even the local words for “yes” and “no.” Locales are well supported in Perl on Unix systems. For Windows, the Win32::Locale module can be installed to provide much of the same information.
Finally, we took a brief look at internationalization, or I18N, the process of writing applications so that they are fully aware of their locale and can communicate with the user in their native language. This is trickier than it might at first seem, since different languages have very different ideas about sentence structure, whether zero is singular or plural (or neither), and a myriad of other concerns. In Perl, we can use Locale::Maketext, a flexible module that enables us to define catalogs or lexicons of messages and, where necessary, message-returning subroutines to generate contextsensitive responses in multiple languages.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2005 Peter Wainwright
About this chapter
Cite this chapter
(2005). Unicode, Locale, and Internationalization. In: Pro Perl. Apress. https://doi.org/10.1007/978-1-4302-0014-7_23
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0014-7_23
Publisher Name: Apress
Print ISBN: 978-1-59059-438-4
Online ISBN: 978-1-4302-0014-7
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books