HelioAraujo
HelioAraujo

Reputation: 299

Plone configuration

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.

Upvotes: 3

Views: 179

Answers (2)

rodfersou
rodfersou

Reputation: 944

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)

Upvotes: 1

Martijn Pieters
Martijn Pieters

Reputation: 1124548

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')

Upvotes: 5

Related Questions