Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 3 weeks ago

#25012 closed enhancement (fixed)

Add UTF-8 charset to load-styles output

Reported by: iamfriendly Owned by: SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.6
Component: Formatting Keywords: has-patch
Focuses: Cc:


I'm not entirely certain I understand why, but every now and again I come across a setup which - intermittently - causes the admin to display incredibly poorly. I'm pretty sure it's down to js/css concatenation - something way above my paygrade. However, I have just come across one particular environment where, rather than using the CONCATENATE_SCRIPTS constant as I normally do, I thought I'd investigate a little further.

My very first attempt was to explicitly set the charset for the load-styles.php to UTF-8 and this - for whatever reason - actually "solved" the issue on this particular environment. I don't think it would actually cause any grief elsewhere, so thought on the off-chance that it may help others, I'd send a patch.

Attachments (2)

25012-rt.diff (464 bytes) - added by iamfriendly 7 years ago.
Added charset to load-styles.php
load-styles.diff (451 bytes) - added by mjbanks 7 years ago.
force UTF-8 charset to load-styles.php

Download all attachments as: .zip

Change History (11)

7 years ago

Added charset to load-styles.php

#1 @iamfriendly
7 years ago

  • Cc richard@… added

#2 @pavelevap
7 years ago

  • Cc pavelevap@… added

#3 @SergeyBiryukov
7 years ago

  • Keywords has-patch added

#4 @nacin
7 years ago

I wonder if it should be get_bloginfo( 'charset' ) actually makes sense. We're not dealing with content here — since we know that our core CSS and JS is UTF-8, I wonder whether we should force UTF-8.

#5 @iamfriendly
7 years ago

Strange that, nacin, I actually had that in place just before I sent over the patch. My thoughts were that it might be that at some point in the future others may want to have non-UTF-8 css/js and having get_bloginfo( 'charset' ) would allow them to do that without any further modifications. I see your point, though - at the moment, that simply isn't possible and so why should we account for it.

Should I make another patch with UTF-8 enforced?

#6 @nacin
7 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to 3.9

I think forcing this to UTF-8 (for both load-styles and load-scripts) makes sense.

7 years ago

force UTF-8 charset to load-styles.php

#7 @mjbanks
7 years ago

  • Keywords has-patch added; needs-patch removed

load-scripts already forces UTF-8, so I added a patch for load-styles to force the charset to UTF-8

#8 @SergeyBiryukov
7 years ago

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

In 27253:

Force UTF-8 in load-styles.php, like we do in load-scripts.php.

props iamfriendly, mjbanks.
fixes #25012.

This ticket was mentioned in Slack in #core by andraganescu. View the logs.

3 weeks ago

Note: See TracTickets for help on using tickets.