WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#2393 closed defect (bug) (fixed)

Encoding problem while uploader is used

Reported by: 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 8 years ago.
Patch for 2.0.4

Download all attachments as: .zip

Change History (10)

comment:1 ilya8 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?

comment:2 ilya8 years ago

  • Milestone set to 2.0.3

comment:3 ilya8 years ago

  • Milestone changed from 2.0.3 to 2.0.4

comment:4 ilya8 years ago

  • Keywords bg|has-patch added

comment:5 ryan8 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.

comment:6 leftjustified8 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.

comment:7 ryan8 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.

leftjustified8 years ago

Patch for 2.0.4

comment:8 ryan8 years ago

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

Looks like this is alread in.

comment:9 anonymous7 years ago

  • Milestone 2.0.4 deleted

Milestone 2.0.4 deleted

Note: See TracTickets for help on using tickets.