WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#4379 closed defect (bug) (fixed)

Bad character in alt attribute of an img tag

Reported by: orvar Owned by: westi
Milestone: 2.7 Priority: high
Severity: normal Version: 2.2
Component: Administration Keywords: has-patch tested
Focuses: Cc:
PR Number:

Description

This is a repost of a ticket in WPMU trac: http://trac.mu.wordpress.org/ticket/294

If you put the character í (iacute) in the alt attribute of an img tag in a post (or use the inline uploader and put í in the title field) and save the post the character becomes corrupted. The second byte of the characters seems to be removed.

The error always occures in WPMU but only in WP if you are a non-admin user. The rest of the post is cut off in WP but in WPMU the result is a strange character (the initial byte plus whatever follows).

Attachments (1)

kses-iacute.diff (510 bytes) - added by nbachiyski 12 years ago.

Download all attachments as: .zip

Change History (11)

#1 @Nazgul
13 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.3 (trunk) to 2.4 (future)

#2 @MtDewVirus
12 years ago

Tested using revision 7236.
Was able to reproduce the problem. Does not affect an admin user.

#3 @sambauers
12 years ago

This doesn't appear to be happening as of [7290]. Tested as both admin and editor. Maybe TinyMCE 3.05 has fixed this?

#4 @tai
12 years ago

Reproduced with revision 7392. I guess the problem is the same as #5917 and #6233.

#5 follow-up: @nbachiyski
12 years ago

  • Keywords has-patch tested added; needs-patch removed
  • Milestone changed from 2.9 to 2.7

The problem is in kses, which strips \xad, because it caues some problems with Opera. Accidentally the UTF-8 encoding of í is \xc3\xad and half of it gets stripped, thus making it invalid UTF-8 character.

Attached is a patch, which replaces í with i in attributes.

#6 in reply to: ↑ 5 @westi
12 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Replying to nbachiyski:

The problem is in kses, which strips \xad, because it caues some problems with Opera. Accidentally the UTF-8 encoding of í is \xc3\xad and half of it gets stripped, thus making it invalid UTF-8 character.

Attached is a patch, which replaces í with i in attributes.

The patch seems invisible to me ;-)

#7 @nbachiyski
12 years ago

Trac needs me to actually upload the patch?! I wrote a decent description of the functionality -- couldn't it write it itself? :-)

It is attached now.

#8 @ryan
12 years ago

There have been reports of this breaking some Japanese characters too. Do we need the more general fix in #5917? I have some issues with the particular patch on that ticket, but the overall method might be worthwhile.

#9 @westi
12 years ago

#5917 looks like it might be a good idea.

Also it looks like the \xad stripping is done twice at the moment.

Forgive my lack of knowledge but is there somewhere I can read up on the Opera issue?

#10 @ryan
11 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed along with #5917

Note: See TracTickets for help on using tickets.