Closed (fixed)
Project:
Drupal core
Version:
master
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Anonymous (not verified)
Created:
18 Jun 2003 at 15:09 UTC
Updated:
1 Oct 2003 at 22:32 UTC
Non-english characters in editable fields and , and on buttons etc are lost.
How to duplicate:
1) Create new node
2) Include some non-english characters. I typed "Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Šš Zz Žž Tt Uu Vv Õõ Ää Öö Üü" which is my native alphabet.
3) Submit
4) See that it looks good.
5) Click administer to edit node
6) See that edit field contains now: "Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Šš Zz Žž Tt Uu Vv Ww յ Ĥ ֶ ܼ"
7) Without modifying anything, just click Submit
See that it looks just like what edit field contained. I mean the text is distorted.
Comments
Comment #1
al commentedThis is due to the content for form items being filtered in some way.
If you look, it breaks on the preview form too.
I'm off to patch this up right now. Will keep you posted.
Comment #2
al commentedRight, the issue is that the form output is going through check_form() which calls drupal_specialchars().
This in turn calls htmlspecialchars() (complete with "utf-8" charset argument). However, despite what the PHP manual[1] says, this is messing up the unicode. If I call htmlspecialchars() _without_ the "utf-8" charset argument, it actually seems to work fine, which is deeply stupid. Am investigating if this breaks Korean... will post patch shortly.
[1] http://www.php.net/manual/en/function.htmlspecialchars.php
Comment #3
al commentedDoesn't break Korean. Yay.
Patch is in contributions/for_review (0033).
Hopefully this should sort things once and for all.
Comment #4
dries commentedI can _not_ reproduce this behavior (without Al's patch). I'm using PHP 4.3.2 with Apache 1.3.27. I tried with both Opera and Firebird so this is not a browser issue.
Comment #5
olav commentedI've just noticed this very same behaviour (all my German Umlauts where gone from both node content as well as locale translations) after updating CVS. Digging down I noticed that the variable site_charset (used to default to "iso-8859-1") was replaced with hard-coded "utf-8" throughout includes/common.inc when this file was updated to r1.213. The log for revision 1.213 (date: 2003/06/08 16:50:04) says
- Charset simpliciations. Patch #46 by Al.
Al, could you please put the original (pre-1.213) behaviour back in?
--
Olav
Comment #6
al commentedAh... It's a bug in PHP.
I think the PHP boyz have bugfixed things for 4.3, but on older versions, calling htmlspecialchars() with a "utf-8" charset rewrites things.
This is why Dries can't reproduce it, but I can on my dev box.
If we just call htmlspecialchars() without the "utf-8" argument, everything works fine for German and Korean. It *might* make Japanese behave less sensibly, but I have no way of testing that.
Dries - please apply the patch - it doesn't do any harm, and we don't want to make PHP 4.3 a requirement for Drupal 4.2...
ing" alt="Smil
ing" />
Comment #7
al commentedComment #8
(not verified) commentedAutomatically closed due to inactivity (marked fixed for 14 days).