[wp-trac] [WordPress Trac] #62995: Uploading Mac screenshots results in broken images, due to question marks inserted in filenames

WordPress Trac noreply at wordpress.org
Fri Jun 27 21:30:16 UTC 2025


#62995: Uploading Mac screenshots results in broken images, due to question marks
inserted in filenames
-------------------------------+------------------------------
 Reporter:  room34             |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  administration
-------------------------------+------------------------------

Comment (by dmsnell):

 That’s right, @siliconforks.

 I’d like to know if what happened to @matt in his report is the same thing
 that happened to @room34 — the database table collation doesn’t support
 the characters.

 > The URL would be something like

 This is not always going to be the case, as highlighted in this ticket. If
 you attempt to save that and the database table is set to a limited
 character set such as one in the ISO-8859 family (`latin1` for example),
 then the `postmeta` value will be transcoded using the replacement
 character for unsupported characters. Here your URL would end up like
 this…

 > `alpha-beta-gamma-???.png`

 This is true regardless of `blog_charset`, which I try to stress to
 everyone because I think its inception and eventual use ended up
 conflicting.

 ----

 Since the ultimate problem is that WordPress isn’t properly generating the
 URLs and that’s split among a thousand different places (proverbially
 speaking, I have not searched or counted), perhaps we could compromise and
 specifically percent-encode only the URL-relevant characters.

 A bigger issue will exist that I think isn’t called out here, that if we
 don’t go //all the way// so to speak, we may introduce problems with
 `wp_unique_filename()` because what that function returns isn’t ultimately
 what we store in the database. If we want to resolve it, we need to encode
 the filename.

 We could always decode when providing download links so that the process
 reverses, but hopefully the specific name of the file matters less and the
 encoding would be fine as is. WordPress already renames the file for a few
 related reasons.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62995#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list