Chapter 20.1. Dealing with Unicode in Python

Even though TurboGears provides comprehensive support for internationalization, if you want your TurboGears application to be easily translatable, there are a few things you need to remember. Your application, like any Python program, requires some attention with respect to how you handle Unicode strings.

In the current version of Python there are strings and Unicode strings. The best piece of advice you can get if you are planning to internationalize your application is:

Always use Unicode strings everywhere!

Every string in your application should be a Unicode string. The only time you should ever convert to/from Unicode is at the IO boundaries of the application. So, if you receive a string from ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.