[mod_python] StringField encoding?

dharana dharana at dharana.net
Sun Jun 19 13:01:00 EDT 2005


But if I understand it correctly (I doubt it anyway). How are you going to store 
an UTF-8 string into a str without loosing information? Let's say, a japanese kanji?

If every string is converted to str (when assigning to StringField) instead of 
unicode it won't be possible to recover the original string. Please tell me I'm 
wrong.

Nick wrote:
> You could try explicity setting the media type in the content type to be 
> ISO-8859-1 (or whatever character set you want to use) instead of unicode.
> 
> Nick
> 
> dharana wrote:
> 
>> Hello,
>>
>> I have a form in one page. I send it with accented chars. Apache is 
>> configured to send content as UTF-8 and browser is Firefox so I 
>> presume Modpython gets utf-8 encoded data.
>>
>> StringField inherits from str so, in this case, what kind of encoding 
>> should I pressume it has? I'm having trouble trying to decode('utf-8') 
>> the StringField instance, that's why I ask.
> 
> 
> 
> 

-- 
dharana



More information about the Mod_python mailing list