Changes between Version 13 and Version 14 of UnicodeBranch
- Timestamp:
- May 16, 2007, 6:20:44 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UnicodeBranch
v13 v14 85 85 * Field sizes for text fields such as !TextField and !CharField are specified in terms of characters, not the number of bytes used in the encoding in the database. All databases supported by Django can handle this (i.e. their ''VARCHAR'' fields are sized in terms of characaters and can store unicode characters). So you do '''not''' need to worry about how many bytes the encoded version of your data will take up when working with lengths. 86 86 87 * You might find the functions {{{django.utils.encoding.smart_string()}}} and {{{d hango.utils.encoding.smart_unicode()}}} useful in your application code. Particularly the latter is handy: it takes a bytestring or unicode string and returns a unicode string. It also knows to convert objects with a {{{__unicode___}}} or {{{__str__}}} method into unicode strings. So if you have a string that is either a bytestring or unicode and you wish to make it uniform -- always a unicode string -- call {{{smart_unicode()}}} on the object.87 * You might find the functions {{{django.utils.encoding.smart_string()}}} and {{{django.utils.encoding.smart_unicode()}}} useful in your application code. Particularly the latter is handy: it takes a bytestring or unicode string and returns a unicode string. It also knows to convert objects with a {{{__unicode___}}} or {{{__str__}}} method into unicode strings. So if you have a string that is either a bytestring or unicode and you wish to make it uniform -- always a unicode string -- call {{{smart_unicode()}}} on the object. 88 88 89 89 === Databases ===