--- Rob Shortt <[EMAIL PROTECTED]> escreveu: > 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?
Don't know. To avoid future problems, I'm wrapping every possible string that will possible have non-ascii chars with Unicode(), so it will not blow elsewhere. Unicode() should do well anone, but in web interface, due an unknow browser behaviour, I'm using the fallback option. Maybe a web_types wrapper for that? > What format is local_conf.py (Is that a stupid question?), the > third field of a TV_CHANNELS entry? Mine is normal strings, all ascii. But god know what users will put there. Also, it works only when I converted it to unicode, maybe it's channel id (I have some unicode+non-ascii ones). > Can things break while comparing an ascii to unicode string? ascii don't break anything. Default (python) encoding is ascii, everthing works well. str -> unicode, unicode -> str. non-ascii (latin-1, utf-8, ...) is the problem. Since python's default is ascii, every non-ascii char will crash your system with the raised exception. From what dischi and I researched, the only way to change python's default is to change the whole site (entirely user system!) and it's not an option, so we use those Unicode() and String(), that uses our encoding (based on environment $FREEVO_LOCALE, $LC_ALL, $LC_MESSAGES and $LANG) > > 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. :) Yes, even I (translator) make sentences that make translator job difficult. But as I need to translate, I look at stuff and say "Why this is done this way?" and need to change that. I'm doing some work in whole freevo to make translators life easy and the interface more polite. Everybody is welcome to help here. If you see a too tech message (things like "chanlist"), point it out! Also, if you find texts inside a plugin that prefix messages with its name, (ie: "record_client: message"), split it in 2 parts, only the message being translateable ( "record_client: " + _( "message" ) ) As we will start to release pre-relases soon, I want to change as much as strings before we do the first pre-release, then we could consider string-freeze and have translators to do their job. Gustavo ______________________________________________________________________ Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora: http://br.yahoo.com/info/mail.html ------------------------------------------------------- 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