Problems with COREBlog and page encoding
or how you shouldn't mix different charsets...
Probably most of you who speak spanish noticed that my posts that were written in than language appeared corrupted until some hours ago.
Well, basically the problem was that everything in this blog is managed in UTF-8 while (I still don't know why) COREBlog itself is encoding all the pages as ISO-8859-15 before serving them. Of course that caused that all the spanish special characters (accented vocals, the famous ñ and some more) appeared as strange symbols on screen.
The solution to that problem is really easy, I only had to add a single line to the blog_header DTML method inside my skin folder:
<dtml-call "REQUEST.RESPONSE.setHeader('Content-Type', 'text/html; charset=utf-8')">
That forced COREBlog to set the proper content-type in each page headers (to UTF-8).
Congratulations for catching this! No idea why it's needed though, seems to work fine with me here...
Was difficult to find, and only after a lot of googling I could find that solution.
Anyway, it is still a mistery why COREBlog was encoding pages as iso-8859-15, I searched through the source code of the Product, the skin DMTL methods, the configs, and no reference at all for that charset.
Ah!, and it is not Zope's fault, cause the rest of the Products (Zwiki for example) are working fine.
Well, of course I know that the header usually has to be set in Zope products output. But what I wonder about is why this wasn't necessary for me. I've double checked, and I don't have that setHeader anywwhere. I also wonder why it wasn't set in COREBlog code already.
Maybe it's because you are already on Zope 2.10 - it could be that 2.10 is picking up the locale or something.
As I've just upgraded my Zope to 2.9 (yeah, I'm way too conservative) I noticed the same problem here. In addition, I had the problem in my wikis too. Since I knew that the upgrade to 2.9 was what had changed, I grepped through the instance directory for 8859-15... and discovered that it's the default for "default-zpublisher-encoding" in zope.conf.
Changing to 'default-zpublisher-encoding utf-8' solved the problems for my wikis, I had already applied the same line as you in coreblog, but I guess it could have solved the coreblog problem too.
YES!, found it. I 2.10 default-zpublisher-encoding defaults to iso-8859-15 too... interesting... Will try setting it to utf-8 and deleting the utf-8 header hack from COREBlog.
Thnx for pointing to that betabug.
There are no trackbacks.