Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#2393 closed defect (bug) (fixed)

Encoding problem while uploader is used

Reported by: jamshidzartoshti's profile JamshidZartoshti Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.2
Component: General Keywords: bg|has-patch
Focuses: Cc:

Description

When I use the upoader to upload my image and write the title and the description in Russian, the "alt" attribute become a garbage encoding when I send the image to the editor. The "title" attribute does not appear. Can you kindly fix it?

Attachments (1)

inline-uploading.php.diff (1.3 KB) - added by leftjustified 19 years ago.
Patch for 2.0.4

Download all attachments as: .zip

Change History (10)

#1 @ilya
19 years ago

  • Version changed from 1.2 to 2.0.2

I've found that it is caused by incorrect use of htmlentities, I've fixed it with the following patch:

diff -Naur wp-admin/inline-uploading.php.orig wp-admin/inline-uploading.php
--- wp-admin/inline-uploading.php.orig  2006-06-11 03:26:01.000000000 +0600
+++ wp-admin/inline-uploading.php       2006-06-11 03:17:59.000000000 +0600
@@ -238,7 +238,7 @@
                        $xpadding = (128 - $image['uwidth']) / 2;
                        $ypadding = (96 - $image['uheight']) / 2;
                        $style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
-                       $title = htmlentities($image['post_title'], ENT_QUOTES);
+                       $title = htmlentities($image['post_title'], ENT_QUOTES, get_settings('blog_charset'));
                        $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />';
@@ -258,7 +258,7 @@
 </div>
 ";
                } else {
-                       $title = htmlentities($attachment['post_title'], ENT_QUOTES);
+                       $title = htmlentities($attachment['post_title'], ENT_QUOTES, get_settings('blog_charset'));
                        $filename = basename($attachment['guid']);
                        $icon = get_attachment_icon($ID);
                        $toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";

Can developers have a look at this?

#2 @ilya
19 years ago

  • Milestone set to 2.0.3

#3 @ilya
19 years ago

  • Milestone changed from 2.0.3 to 2.0.4

#4 @ilya
19 years ago

  • Keywords bg|has-patch added

#5 @ryan
19 years ago

We typically never use htmlentities due to the encoding issues. Let's remove the htmlentities references entirely. Passing blog_charset as the encoding is not always sufficient.

#6 @leftjustified
19 years ago

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

wp_specialchars is in where htmlentities was suggested. Tested inline-uploading functions extensively on a utf-8 blog. Ticket author leaves no mention of charset, so utf-8 was (hopefully) assumed.

#7 @ryan
19 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This looks good in 2.1 but let's get it fixed for 2.0.4.

@leftjustified
19 years ago

Patch for 2.0.4

#8 @ryan
19 years ago

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

Looks like this is alread in.

#9 @(none)
18 years ago

  • Milestone 2.0.4 deleted

Milestone 2.0.4 deleted

Note: See TracTickets for help on using tickets.