Changes between Version 22 and Version 23 of UnicodeBranch
- Timestamp:
- May 24, 2007, 8:05:46 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UnicodeBranch
v22 v23 58 58 One of the design goals of the Unicode branch is that very little significant changes to existing third-party code should be required. However, there are some things that developers should be aware of when writing applications designed to handle international input. 59 59 60 A detailed list of things you might wish to think about when writing your code is in the unicode.txtfile in the documentation directory. For the programmer on a deadline, here is the cheatsheet version (if you only use ASCII strings, none of these changes are necessary):60 A detailed list of things you might wish to think about when writing your code is in the {{{unicode.txt}}} file in the documentation directory. For the programmer on a deadline, here is the cheatsheet version (if you only use ASCII strings, none of these changes are necessary): 61 61 62 62 1. Change the {{{__str__}}} methods on your models to be {{{__unicode__}}} methods. Just change the name. Usually, nothing else will be needed. 63 63 64 2. Look for any {{{str()}}} calls in your code that operate on model fields. These should almost always be changed to {{{smart_unicode()}}} calls (which is imported from {{{django.utils.encoding}}}). 64 2. Look for any {{{str()}}} calls in your code that operate on model fields. These should almost always be changed to {{{smart_unicode()}}} calls (which is imported from {{{django.utils.encoding}}}). In some cases, you may need to use {{{force_unicode()}}} (in the same module), but starting with a global change to {{{smart_unicode()}}} and then checking for problems is the "quick fix" way. (Details of the differences between the two functions are in {{{unicode.txt}}}.) 65 65 66 66 3. Use the unicode versions of the {{{django.utils.translation.*}}} functions. Replace {{{gettext}}} and {{{ngettext}}} with {{{ugettext}}} and {{{ungettext}}} respectively. There are also {{{ugettext_lazy}}} and {{{ungettext_lazy}}} functions if you use the lazy versions.