Closed Bug 332459 Opened 18 years ago Closed 18 years ago

Edit Item form accepts text as ISO-8859-1 encoding even though page is UTF-8

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla-mozilla-20000923, Assigned: benjamin)

Details

Attachments

(1 file)

The web pages for UMO^W AMO all declare themselves to be UTF-8. This is fine and good. However, the form submission handling seems to interpret data as ISO-8859-1 (or some other single-byte encoding).

This means that if you enter, say, é (e-acute) you end up with two characters - é (capital A with 'o', copyright). That's the two bytes for the UTF-8 encoding as separate single-byte characters. These two characters are what appears everywhere, both in the edit box and public pages.

The workaround I found for now is that after loading the Item Edit page, to change the browser into ISO-8859-1, enter data and submit, and that will work (if the characters you want work in that charset).
I think this is caused by the code in core/inc_global.php, lines 70-79. All values in $_GET and $_POST are passed through (among other things) htmlentities(). This defaults to ISO-8859-1.

"htmlentities(foo)" should be changed to "htmlentities(foo, ENT_COMPAT, 'UTF-8')".
Target Milestone: 1.0 → 2.1
Looks like we're running into that in a bigger style with adding dictionaries for Gecko-1.8.1-based applications. If one has non-ASCII characters in install.rdf (correctly encoded as UTF-8), those strings are displayed correctly in the "add item" pages, but then end up garbled up as described in comment 0 when you save them...
Like this, against AMO1 sources.
Assignee: morgamic → benjamin
Status: NEW → ASSIGNED
Attachment #230995 - Flags: first-review?(morgamic)
Comment on attachment 230995 [details] [diff] [review]
Use UTF-8 encoding, rev. 1

This looks good, and works fine.
Attachment #230995 - Flags: first-review?(morgamic) → first-review+
Checked in this patch -- we will push this into production along with a fix for bug 346171.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: 2.1 → ---
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: