charset=utf-8

Avatar image for meb
meb

21

Forum Posts

2778

Wiki Points

0

Followers

Reviews: 1

User Lists: 10

#1  Edited By meb

The HTTP 'Content-Type' header that is returned when i make requests to the API has 'text/xml' as a value when it should have 'text/xml;charset=utf-8'
 
This seems like a trivial issue, but it really isn't. This can cause some problems for software trying to guess the encoding of the xml file. According to the RFC spec, you're supposed to ignore anything about the encoding that's specified inside the xml file, and instead look at the content-type header. If there is no charset parameter in the content-type header, you're supposed to default to 'us-ascii' instead of 'utf-8'. Kinda problematic if software is up to spec and following the rules.
 
More info here:  http://feedparser.org/docs/character-encoding.html

Avatar image for andy
andy

445

Forum Posts

298

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

#2  Edited By andy

Good catch. I just committed a fix. I'll go live with the next deployment.

Avatar image for meb
meb

21

Forum Posts

2778

Wiki Points

0

Followers

Reviews: 1

User Lists: 10

#3  Edited By meb
@andy said:

" Good catch. I just committed a fix. I'll go live with the next deployment. "

You are awesome, thanks. Another observation - I also noticed that the api's http server doesn't compress anything when i send it the 'accept-encoding: gzip, deflate' http header. A quick Chrome audit says you could be saving 2/3rds bandwidth w/ a quick server configuration change. Add 'text/xml' to gzip_types or something like that (I've never used nginx). Then you can tell your boss you're saving him money! 
 
Thanks again
Avatar image for thatfrood
thatfrood

3472

Forum Posts

179

Wiki Points

0

Followers

Reviews: 8

User Lists: 15

#4  Edited By thatfrood

thanks meb :)