Opened 12 years ago
Closed 12 years ago
#21217 closed defect (bug) (fixed)
Encoding problems with uploading media files
Reported by: | pavelevap | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | 3.4.1 |
Component: | Media | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Testing media filename: "Žluťoučký kůň.png"
1) WP 3.4.1 (standard Linux webhosting, using Chrome):
- File successfully uploaded as "Žluťoučký-kůň.png" (space replaced).
- But filename is displayed as "luťoučký-kůň.png".
- URL is http://domain/wp-content/uploads/2012/07/Žluťoučký-kůň.png (and file is also accessible on this URL without problem).
So, why is filename displayed without first character?
2) WP 3.4.1 (xampp, Windows computer, Chrome):
- File uploaded as "Žluťoučký-kůň.png" (space replaced).
- Filename is displayed as "Žluťoučký-kůň.png".
- URL is http://localhost/wp-content/uploads/Žluťoučký-kůň.png
- But file is not visible and in uploads directory can be seen as "Ĺ˝luĹĄouÄŤkĂ˝-kĹŻĹ.png".
In this case I can see this media file only encoded by Javascript (image editing tool), for example on URL http://localhost/wp-admin/admin-ajax.php?action=imgedit-preview&_ajax_nonce=8f7fa9ba05&postid=21249&rand=49045
Attachments (2)
Change History (11)
#3
in reply to:
↑ 2
@
12 years ago
- Milestone changed from Awaiting Review to 3.5
Replying to nacin:
We also have wp_basename().
Thanks for the hint, this works too. wp_basename()
is used for similar tasks in image_downsize()
, image_resize()
and a few other places.
#4
@
12 years ago
SergeyBiryukov: Thank you, Sergey. I did not notice this ticket related to second point.
#5
@
12 years ago
21217.2.patch looks good, and is a quick win for fixing point (1), and point (2) is a duplicate of #15955, so if @SergeyBiryukov's patch is applied, we can close out this ticket.
#6
@
12 years ago
While I didn't add unit tests for get_media_item() patched here (it's way too large of a method to unit test), I did however add unit tests for wp_basename for this situation.
Point 2 is specific to Windows builds of PHP (see ticket:15955:11, #18634, #19842).
Point 1 is caused by
basename()
usage to get the file name inget_media_item()
:http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/includes/media.php#L1063
From php.net:
21217.patch fixes point 1 using one of the workarounds suggested there.