Closed Bug 1186268 Opened 9 years ago Closed 8 years ago

Weird characters in the CSS showing up [encoding issue]

Categories

(DevTools :: Style Editor, defect, P3)

40 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1301854

People

(Reporter: karlcow, Unassigned)

References

Details

Attachments

(1 file)

Attached image encoding-issue-css.png
1. Go to http://blogs.yahoo.co.jp/
2. Inspect Element 
3. Go to the style editor and choose main-2.2.26.css

See the weird two characters at the beginning of the stylesheet.

```
鏤�.fortuneHeader,.mypageCircleHeader {
	position:relative
}
```

I suspect it's probably due to an issue with encoding of the CSS and/or BOM.


The site doesn't send any specific encoding for the CSS. 

→ http --print hH GET http://i.yimg.jp/images/blog/smartphone/v2/css/main-2.2.26.css

GET /images/blog/smartphone/v2/css/main-2.2.26.css HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: i.yimg.jp
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 201
Cache-Control: public
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 32306
Content-Type: text/css
Date: Wed, 22 Jul 2015 00:38:26 GMT
Expires: Wed, 22 Jul 2015 00:42:12 GMT
Last-Modified: Fri, 17 Jul 2015 05:52:07 GMT
Server: YTS/1.20.10
Vary: Accept-Encoding
Via: HTTP/1.1 ytsorigin7012.img.bbt.yahoo.co.jp (YahooTrafficServer/1.20.10 [cHs f ]), HTTP/1.1 yts7032.img.bbt.yahoo.co.jp (YahooTrafficServer/1.20.10 [cHs f ])


I wonder if there is an opportunity to send a message about encoding mismatch and what the browser needs. Not sure.
I see it starting with EF BB EF, which is the UTF-8 BOM.

The rules to follow are here:
https://developer.mozilla.org/en-US/docs/Web/CSS/@charset

The stylesheet actor tries to follow these:

https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/stylesheets.js#879

... but evidently nothing strips the BOM.
One way to reproduce this is to make a .css that starts with a UTF-8 BOM,
then reference it from a html that uses a non-UTF-8 charset.
Inspector bug triage (filter on CLIMBING SHOES).
Priority: -- → P3
Bug 1301854 has a nice test for a related case.
See Also: → 1301854
Doing the work in the other bug.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: