>> Comment By: [EMAIL PROTECTED] (bacademy)
> Date: 2006-11-13 23:10
> 
> Message:
> Logged In: YES 
> user_id=816562
> 
> I tend to read "encode" as "to" and "decode" as from.
> I also helps to remember that there is always a pair 
> (from,to) of strings, and both encodings must be known.
> It is far easier if strings are always kept as unicode, 
> because an unicode string knows its encoding.
> So s.encode('char-set') will never fail if s can be 
> encoded in 'char-set'.  Problems arise because 
> non-unicode python strings can contain non-ascii 
> characters, but the default character set is ascii when 
> encoding or decoding.

The problem with the names is that there is no 'from' so encode/decode
are a bit ambiguous, what I mean is that decode converts a string to a
Unicode string and encode a Unicode string to a string.

One thing I have noticed is that you can write a script printing
different string formats that works on the console but not when
redirecting to a file.

Freevo does use Unicode as much as possible, however tv_grab write xmltv
in latin-1, so this data needs converting to Unicode. I think that this
is where the problem stems.

> 
> Now if I recall, XML parser always should return unicode 
> strings which is good. But perhaps that is converted to 
> basic python string in freevo in some cases, which 
> should not be done. I'll need to take a look how freevo 
> handles it.  Keeping everything in freevo in UTF-8 might 
> be a good solution, as it can represent everything, and 
> it is a superset of ascii (7 bit ascii chars only take a 
> byte).
> 
> Another curve ball is the terminal -- it is a third 
> character set to consider, some strings will not render 
> correctly on terminals  
> (http://www.jorendorff.com/articles/unicode/python.html)
> 
> Unicode encode,decode should not really come up in that 
> many places in the code. And btw. 
> sys.setdefaultencoding() is only available in the 
> init.py, which is bit of a bummer... I haven't really 
> looked into why is that yet, and is there a 
> workaround...
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to