Gustavo Sverzut Barbieri wrote:
Please, take care when doing stuff like that.
1) fv.res is unicode, since i18n messages are unicode and str + unicode
-> unicode
2) chan can be a string with non-ascii chars, since it came from
POST/GET, when python tries to merge it with fv.res and so make it
unicode, it will break! If you came to this problem, please transform
chan to unicode. Seems to be that browsers exchange data in latin-1, so
i'm using this code:

   chan = Unicode(fv.formValue(form, 'chan'))
   if isinstance( chan, str ):
      chan = Unicode( chan, 'latin-1' )

Can't we bury stuff like this in lower level code? Its annoying to have to jump through all those hoops. Also is chan ever going to be unicode? What format is local_conf.py (Is that a stupid question?), the third field of a TV_CHANNELS entry? Can things break while comparing an ascii to unicode string?


This way we try to convert to unicode using the default encoding, if it
fails, fall back to latin-1.

3) Please, collaborate with i18n efforts! :)

Don't use this:
'<h4>ERROR: no program found on %s at %s</h4>' % (chan, start)

Use this instead:
'<h4>'+_('ERROR')+': '+(_('no program found on %s at %s') %
(chan,start))+'</h4>'

Sorry, its hard to remember... I'll try more. :)


-Rob



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Freevo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to