Skip to main content

Unicode, Locale, and Internationalization

  • Chapter
Pro Perl
  • 1147 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Rights and permissions

Reprints 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

Publish with us

Policies and ethics