"Edit as comment" mangles charset




11 years ago
2 years ago


(Reporter: philor, Unassigned)


Bug Flags:
blocking3.2.3 -




1. Add an attachment with a non-ISO-8859-1 character, like a Mozilla DTD with a UTF-8 ellipsis character
2. Go to the &action=edit URL
3. Note that the character is properly displayed
4. "Edit as comment"
5. Note that if your install is using MySQL, the character is mangled into the "…" that's the result of treating UTF-8 as ISO-8859-1

After seeing one on bmo, I added one to landfill's bugzilla-tip and bugzilla-3.2-branch, both of which failed, and added one to bugzilla-tip-pg which did not fail (the one I added to bugzilla-tip-oracle is, sadly, too unsafe to be viewed by ordinary mortals, so I don't know whether it worked).
Flags: blocking3.2.3?
... is also mangled in bugzilla-tip-oracle. I just turned on allow_attachment_display there.
Actually, all DBs should be doing this. If they're not, it's a sign that they're treating the raw bytes of attachments as always being utf8, which is not good.

The problem here is that we no longer get the advantage of the browser's charset detector, since we no longer use XMLSerializer to display the attachment.

We actually have no idea what character set the attachment is in, though we could use Encode::Guess (which isn't that reliable) on it and convert to utf8 on display for "edit attachment as comment", if the utf8 bit is on, for text/* attachments.

I'm going to leave the blocking flag as "?" until somebody does more investigation into a good way to fix this and we see how invasive it would be.
Target Milestone: --- → Bugzilla 3.2
The symptom is probably introduced by attachment 286357 [details] [diff] [review]
(In reply to comment #3)
> The symptom is probably introduced by attachment 286357 [details] [diff] [review]

  Sort of. That plus a combination of bug 38862 (more bug 38862 than the utf8 bug).
I can't make this a blocker, because I don't even know if it's actually even *fixable* in any reasonable way.
Flags: blocking3.2.3? → blocking3.2.3-
Duplicate of this bug: 504104
Bugzilla 3.2 is restricted to security bugs only. Mass-retargetting to 3.6.
Target Milestone: Bugzilla 3.2 → Bugzilla 3.6
Blocks: 365926
No longer blocks: 365926
Duplicate of this bug: 594518
Target Milestone: Bugzilla 3.6 → Bugzilla 4.0
Duplicate of this bug: 691783
This is not limited to MySQL. The problem is reproducible with PostgreSQL.
This is not limited to MySQL. The problem is reproducible with PostgreSQL.
Summary: "Edit as comment" mangles charset when using MySQL → "Edit as comment" mangles charset
Bugzilla 4.0 is restricted to security fixes only.
Target Milestone: Bugzilla 4.0 → ---
Duplicate of this bug: 935762
i couldn't search in regular attachment mode so in order to do so, I switched to edit as comment mode.
You need to log in before you can comment on or make changes to this bug.