[mod_python] StringField encoding?

Nick nick at dd.revealed.net
Sun Jun 19 13:06:48 EDT 2005


That's why I avoid dealing with unicode altogether :)

Sorry that's not much help.

Nick

dharana wrote:
> 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.
>>
>>
>>
>>
>>
> 



More information about the Mod_python mailing list