[Product-Developers] Plone string encoding problem

Mikko Ohtamaa mikko+plone at redinnovation.com
Thu Dec 22 14:31:31 UTC 2011


On Thu, Dec 22, 2011 at 12:44 PM, mcelotti <m.celotti at tecnoteca.it> wrote:
> I have a Document (type_name=Document) containing this text:
> "accents è à ì ò ù"
>
> When I open the doc everything is fine and all the accents are correct.
>
> The problem comes with my custom script:
>
> items = context.portal_catalog(portal_type='Document',
> UID='a64ce6ceb295bcaa48ebff874379d907')
> array=[]
> for item in items:
>  dict={}
>  obj = item.getObject()
>  dict['text']= obj.getText()
>  array.append(dict)
> return array
>
> The output is:
> "accents \xc3\xa8 \xc3\xa0 \xc3\xac \xc3\xb2 \xc3\xb9"
>
> I need to write original content to database (mysql utf-8) but I'm stuck
> with this problem ...
>

http://collective-docs.readthedocs.org/en/latest/troubleshooting/unicode.html

All Archetypes accessor methods (should) return UTF-8 bytecode strings.


-- 
Mikko Ohtamaa
http://opensourcehacker.com
http://twitter.com/moo9000


More information about the Product-Developers mailing list