Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plone configuration

Tags:

plone

zpt

Plone is showing the special chars from my mother language (Brazilian Portuguese) in its pages. However, when I use a spt page I created it shows escape sequences, e.g.:

Educa\xc3\xa7\xc3\xa3o

instead of

Educação

(by the way, it means Education). I'm creating a python function to replace the escape sequences with the utf chars, but I have a feeling that I'm slaving away without need.

like image 793
HelioAraujo Avatar asked Jan 23 '26 23:01

HelioAraujo


2 Answers

Are you interpolating catalog search results? Those are, by necessity (the catalog cannot handle unicode) UTF-8 encoded.

Just use the .decode method on strings to turn them into unicode again:

value = value.decode('utf8')
like image 176
Martijn Pieters Avatar answered Jan 25 '26 12:01

Martijn Pieters


A better way should be to use safe_unicode function https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/utils.py#L458

from Products.CMFPlone.utils import safe_unicode
value = safe_unicode(value)
like image 38
rodfersou Avatar answered Jan 25 '26 13:01

rodfersou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!