plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
254 stars 191 forks source link

Diazo theme with subrequest show wrong characters (Python 3) #3068

Closed mauritsvanrees closed 4 years ago

mauritsvanrees commented 4 years ago

In Diazo rules, you can use <replace href="@@some-fragment" /> to insert the contents of a some-fragment view. We use this in a Plone 5.1 site to show some text that Managers can edit in a control panel. Works fine, also with non-ascii. On plone 5.2 with Python 3, it works with ascii, but shows very ugly when the fragment contains non-ascii.

To reproduce:

What I expect to happen:

The non-ascii Greek characters should show up readable. (If you can read Greek, anyway.)

What actually happened:

This showed:

Αρχική Σελίδα

Even Greeks can't read this.

Note: I have the same problem when I use French and a simple accented character. Actualités is rendered as Actualités.

What version of Plone/ Addons I am using:

Plone 5.2.1 on Python 3.7. With Python 2.7 it works fine.

I guess this is a problem somewhere in plone.app.theming or Diazo. In plone.app.theming this code in utils.py is called. With a subrequest I get a response in bytes with a charset utf-8. At the end of this method, result is a string and I can print it just fine.

Any idea?

csanahuja commented 4 years ago

This is what I reported in plone.app.theming in case it helps: https://github.com/plone/plone.app.theming/issues/162

mauritsvanrees commented 4 years ago

Thanks for the pointer. That helps. I made a PR: https://github.com/plone/plone.app.theming/pull/180