WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 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:

Description

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 8 months ago.
Added charset to load-styles.php
load-styles.diff (451 bytes) - added by mjbanks 3 months ago.
force UTF-8 charset to load-styles.php

Download all attachments as: .zip

Change History (10)

iamfriendly8 months ago

Added charset to load-styles.php

comment:1 iamfriendly8 months ago

  • Cc richard@… added

comment:2 pavelevap8 months ago

  • Cc pavelevap@… added

comment:3 SergeyBiryukov8 months ago

  • Keywords has-patch added

comment:4 nacin8 months 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.

comment:5 iamfriendly8 months 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?

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

mjbanks3 months ago

force UTF-8 charset to load-styles.php

comment:7 mjbanks3 months 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

comment:8 SergeyBiryukov8 weeks 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.

Note: See TracTickets for help on using tickets.