Issue #1113 new

set charset header in a wrong logic

Anonymous created an issue

I used a tool which used cherryPy, and it gave me a strange result that it always returned me a wrong charset in the http header. I analysed it and found that it caused by a piece of logic of cherryPy, cherryPy will pick the first charset of which the browsers' declaring charsets as the response's charset declaration of http header if cherryPy don't know the encoding of a file. But I have to say it is so strange that how you can declare a document's charset by the client's capacity declaration? In my opinion, if you don't know the encoding of a document, it is better to left it in blank, the browser will be clever than any other software to guess the correct encoding of a document.

Here is my use case: writting a page in UTF-8, and then openning it in a English version IE, in a Chinese version Chrome and also in a Japanese version Firefox, I believe we can understand that how unreasonable the current logic is - cherryPy will return 3 different charset headers for the unique file.

Comments (1)

  1. Log in to comment