Edgewall Software

Changes between Version 8 and Version 9 of TracDev/UnicodeGuidelines


Ignore:
Timestamp:
Oct 14, 2006, 5:27:44 PM (18 years ago)
Author:
Christian Boos
Comment:

Answer to James Mills' question

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/UnicodeGuidelines

    v8 v9  
    302302Feel free to correct me, ask questions, etc.; this is a Wiki. :)
    303303
     304----
    304305Q: When dealing with plugins that weren't designed to be unicode friendly and used unicode in favour of to_unicode, what parts of the plugin should be updated, what should use to_unicode ? --JamesMills
     306
     307A: There shouldn't be any reason to replace a working call to `unicode()` by a call to `to_unicode()`, unless you specified the encoding, like in:
     308{{{
     309  ustring = unicode(data_from_trac, 'utf-8')
     310}}}
     311The above doesn't work if `data_from_trac` is actually an unicode object (you'd get `TypeError: decoding Unicode is not supported`).
     312
     313In this case, either don't use `unicode` at all (0.10 and above only plugins) or replace it by `to_unicode` (0.9 and 0.10 plugins).
    305314
    306315----