#9655 closed enhancement (fixed)
Banishing ASCII quotes and apostrophes. Consolidated patch
Reported by: | demetris | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | UI | Keywords: | has-patch tested commit |
Focuses: | Cc: |
Description
Please commit this before we go into string freeze for 2.8! :-)
The patch replaces all ASCII quotes (double and single) in the admin area with proper double quotes (characters 8220 and 8221), and all ASCII apostrophes with proper apostrophes (char. 8217).
I also found a few apostrophes that were typed literally (no escaping) within strings enclosed in double quotes. It seemed to me this was the only reason double quotes were used for those strings, so, in those few cases, I also changed the double quotes enclosing the strings to single quotes.
I did not change the single ASCII quotes for some JS confirm dialogs. E.g.:
'Cancel' to stop, 'OK' to proceed.
I think these single quotes are not needed at all. (My personal preference is to use quotation marks sparingly — only when absolutely necessary.)
There are also quite a few triple dots (...) that could be replaced with the ellipsis character, but I think it’s not worth disturbing strings just to put typographical ellipses in them. Triple dots seem fine to me.
PS. I would not go into the trouble of making this patch, but some instances are in prominent places, like the installer (first impression!) or in widgets descriptions.
Attachments (2)
Change History (14)
#2
@
16 years ago
If those files are UTF-8 encoded there should be no need to uses &...; entities. The chars could be written directly in there. Anyway, I do not have problems with ASCII quotes and apostrophes. They are quite stable.
#3
follow-up:
↓ 4
@
16 years ago
Updated patch for r11110.
@hakre:
The files are not in UTF-8.
They would be much easier to read if they were in UTF-8 and we could get rid of the monstrous entities and NCRs, but, I imagine, we would have other problems then, more serious: Many users edit WP files on Windows with Notepad, which adds a BOM when saving a file in UTF-8. :-D
#4
in reply to:
↑ 3
@
16 years ago
Replying to demetris:
The files are not in UTF-8.
you made me actually run my checktool on it. all files are UTF-8. you are patching against modified files if yours aren't. grab a copy from svn.
(some) output for the files in wp-admin/:
+------+--------------------------------------------------+------------+------+ | # | Filename | Encode | LE | +------+--------------------------------------------------+------------+------+ | 162 | /admin-ajax.php | UTF-8 | WIN | | 163 | /admin-footer.php | UTF-8 | WIN | | 164 | /admin-functions.php | UTF-8 | WIN | | 165 | /admin-header.php | UTF-8 | WIN | | 166 | /admin-post.php | UTF-8 | WIN | | 167 | /admin.php | UTF-8 | WIN | | 168 | /async-upload.php | UTF-8 | WIN | | 169 | /cache-manifest.php | UTF-8 | WIN | | 170 | /categories.php | UTF-8 | WIN | | 171 | /comment.php | UTF-8 | WIN | | 172 | /custom-header.php | UTF-8 | WIN | | 173 | /edit-attachment-rows.php | UTF-8 | WIN | | 174 | /edit-category-form.php | UTF-8 | WIN | | 175 | /edit-comments.php | UTF-8 | WIN | | 176 | /edit-form-advanced.php | UTF-8 | WIN | | 177 | /edit-form-comment.php | UTF-8 | WIN | | 178 | /edit-link-categories.php | UTF-8 | WIN | | 179 | /edit-link-category-form.php | UTF-8 | WIN | | 180 | /edit-link-form.php | UTF-8 | WIN | | 181 | /edit-page-form.php | UTF-8 | WIN | | 182 | /edit-pages.php | UTF-8 | WIN | | 183 | /edit-post-rows.php | UTF-8 | WIN | | 184 | /edit-tag-form.php | UTF-8 | WIN | | 185 | /edit-tags.php | UTF-8 | WIN | | 186 | /edit.php | UTF-8 | WIN | | 187 | /export.php | UTF-8 | WIN | | 188 | /gears-manifest.php | UTF-8 | WIN | | 219 | /import/blogger.php | UTF-8 | WIN | | 220 | /import/blogware.php | UTF-8 | WIN | | 221 | /import/btt.php | UTF-8 | WIN | | 222 | /import/dotclear.php | UTF-8 | WIN | | 223 | /import/greymatter.php | UTF-8 | WIN | | 224 | /import/jkw.php | UTF-8 | WIN | | 225 | /import/livejournal.php | UTF-8 | WIN | | 226 | /import/mt.php | UTF-8 | WIN | | 227 | /import/opml.php | UTF-8 | WIN | | 228 | /import/rss.php | UTF-8 | WIN | | 229 | /import/stp.php | UTF-8 | WIN | | 230 | /import/textpattern.php | UTF-8 | WIN | | 231 | /import/utw.php | UTF-8 | WIN | | 232 | /import/wordpress.php | UTF-8 | WIN | | 233 | /import/wp-cat2tag.php | UTF-8 | WIN | | 234 | /import.php | UTF-8 | WIN | | 302 | /includes/admin.php | UTF-8 | WIN | | 303 | /includes/bookmark.php | UTF-8 | WIN | | 304 | /includes/class-ftp-pure.php | UTF-8 | WIN | | 305 | /includes/class-ftp-sockets.php | UTF-8 | WIN | | 306 | /includes/class-ftp.php | UTF-8 | WIN | | 307 | /includes/class-pclzip.php | UTF-8 | WIN | | 308 | /includes/class-wp-filesystem-base.php | UTF-8 | WIN | | 309 | /includes/class-wp-filesystem-direct.php | UTF-8 | WIN | | 310 | /includes/class-wp-filesystem-ftpext.php | UTF-8 | WIN | | 311 | /includes/class-wp-filesystem-ftpsockets.php | UTF-8 | WIN | | 312 | /includes/class-wp-filesystem-ssh2.php | UTF-8 | WIN | | 313 | /includes/class-wp-upgrader.php | UTF-8 | WIN | | 314 | /includes/comment.php | UTF-8 | WIN | | 315 | /includes/dashboard.php | UTF-8 | WIN | | 316 | /includes/export.php | UTF-8 | WIN | | 317 | /includes/file.php | UTF-8 | WIN | | 318 | /includes/image.php | UTF-8 | WIN | | 319 | /includes/import.php | UTF-8 | WIN | | 320 | /includes/manifest.php | UTF-8 | WIN | | 321 | /includes/media.php | UTF-8 | WIN | | 322 | /includes/misc.php | UTF-8 | WIN | | 323 | /includes/plugin-install.php | UTF-8 | WIN | | 324 | /includes/plugin.php | UTF-8 | WIN | | 325 | /includes/post.php | UTF-8 | WIN | | 326 | /includes/schema.php | UTF-8 | WIN | | 327 | /includes/taxonomy.php | UTF-8 | WIN | | 328 | /includes/template.php | UTF-8 | WIN | | 329 | /includes/theme-install.php | UTF-8 | WIN | | 330 | /includes/theme.php | UTF-8 | WIN | | 331 | /includes/update-core.php | UTF-8 | WIN | | 332 | /includes/update.php | UTF-8 | WIN | | 333 | /includes/upgrade.php | UTF-8 | WIN | | 334 | /includes/user.php | UTF-8 | WIN | | 335 | /includes/widgets.php | UTF-8 | WIN | | 336 | /index-extra.php | UTF-8 | WIN | | 337 | /index.php | UTF-8 | WIN | | 338 | /install-helper.php | UTF-8 | WIN | | 339 | /install.php | UTF-8 | WIN | | 342 | /js/revisions-js.php | UTF-8 | WIN | | 343 | /link-add.php | UTF-8 | WIN | | 344 | /link-category.php | UTF-8 | WIN | | 345 | /link-manager.php | UTF-8 | WIN | | 346 | /link-parse-opml.php | UTF-8 | WIN | | 347 | /link.php | UTF-8 | WIN | | 348 | /load-scripts.php | UTF-8 | WIN | | 349 | /load-styles.php | UTF-8 | WIN | | 350 | /media-new.php | UTF-8 | WIN | | 351 | /media-upload.php | UTF-8 | WIN | | 352 | /media.php | UTF-8 | WIN | | 353 | /menu-header.php | UTF-8 | WIN | | 354 | /menu.php | UTF-8 | WIN | | 355 | /moderation.php | UTF-8 | WIN | | 356 | /options-discussion.php | UTF-8 | WIN | | 357 | /options-general.php | UTF-8 | WIN | | 358 | /options-head.php | UTF-8 | WIN | | 359 | /options-media.php | UTF-8 | WIN | | 360 | /options-misc.php | UTF-8 | WIN | | 361 | /options-permalink.php | UTF-8 | WIN | | 362 | /options-privacy.php | UTF-8 | WIN | | 363 | /options-reading.php | UTF-8 | WIN | | 364 | /options-writing.php | UTF-8 | WIN | | 365 | /options.php | UTF-8 | WIN | | 366 | /page-new.php | UTF-8 | WIN | | 367 | /page.php | UTF-8 | WIN | | 368 | /plugin-editor.php | UTF-8 | WIN | | 369 | /plugin-install.php | UTF-8 | WIN | | 370 | /plugins.php | UTF-8 | WIN | | 371 | /post-new.php | UTF-8 | WIN | | 372 | /post.php | UTF-8 | WIN | | 373 | /press-this.php | UTF-8 | WIN | | 374 | /profile.php | UTF-8 | WIN | | 375 | /revision.php | UTF-8 | WIN | | 376 | /setup-config.php | UTF-8 | WIN | | 377 | /sidebar.php | UTF-8 | WIN | | 378 | /theme-editor.php | UTF-8 | WIN | | 379 | /theme-install.php | UTF-8 | WIN | | 380 | /themes.php | UTF-8 | WIN | | 381 | /tools.php | UTF-8 | WIN | | 382 | /update-core.php | UTF-8 | WIN | | 383 | /update-links.php | UTF-8 | WIN | | 384 | /update.php | UTF-8 | WIN | | 385 | /upgrade-functions.php | UTF-8 | WIN | | 386 | /upgrade.php | UTF-8 | WIN | | 387 | /upload.php | UTF-8 | WIN | | 388 | /user-edit.php | UTF-8 | WIN | | 389 | /user-new.php | UTF-8 | WIN | | 390 | /users.php | UTF-8 | WIN | | 391 | /widgets.php | UTF-8 | WIN | +------+--------------------------------------------------+------------+------+
#5
@
16 years ago
I suggest to close this as invalid because the files are actuall utf-8 and the changes are not needed. maybe the typos with can not / cannot but it should be taken care for translations here as well.
#6
follow-up:
↓ 7
@
16 years ago
@hakre:
- If a file only has single-byte characters from 0 to 127 and does not have a BOM, how does your tool determine it is UTF-8?
- WordPress spends resources to run everything on the front-end through a typography filter, and you are saying we don’t need this in the back-end, where it is done simply by hard-coded HTML?
#7
in reply to:
↑ 6
@
16 years ago
Replying to demetris:
@hakre:
- If a file only has single-byte characters from 0 to 127 and does not have a BOM, how does your tool determine it is UTF-8?
Those files are UTF-8 encoded. RTFM.
- WordPress spends resources to run everything on the front-end through a typography filter, and you are saying we don’t need this in the back-end, where it is done simply by hard-coded HTML?
I do not understand your question.
#8
follow-up:
↓ 9
@
16 years ago
- Keywords tested added
hakre, behave yourself! :)
I you want to know why your tool says that a plain ASCII file is UTF-8, and why this diagnosis is not helpful in our context, please ask and I’ll explain.
But don’t comment on a ticket that you don’t understand, proposing to close it. (It’s not the first time. Recently you closed another ticket of mine, which was then reopened and now is patched in trunk: #9399.)
About the question that you don’t understand: See wptexturize and the way in which WP prides itself on its typography.
Added “tested”. The patch has been running on 3 setups since I made it and no accidents have been reported. :-D
BTW, here are the two patches that were consolidated and updated into this: #8338 and #8636.
#9
in reply to:
↑ 8
@
16 years ago
Replying to demetris:
hakre, behave yourself! :)
I you want to know why your tool says that a plain ASCII file is UTF-8, and why this diagnosis is not helpful in our context, please ask and I’ll explain.
when using utf-8 files there is no need to put those quotes into entities. that's all. I have no idea wether or not it is intended that wordpress ships in a specific encoding. wether be it ascii 7bit nor utf-8 or even latin-1. maybe you know?
Forgot to mention:
The patch also fixes some typos I found along the way, mainly a few “can not” changed to “cannot”.