LINUX.ORG.RU

История изменений

Исправление Zubok, (текущая версия) :

да, именно из-за этой эвристики я и начал использовать url-insert-file-contents

Ну, эвристика - вещь не очень красивая. В данном случае работает, но может не угадать. С однобайтными может не угадать. Я бы, конечно, делал процедуру, что сначала смотрел HTTP headers, а если там нет, то на <meta>, так как HTTP имеет больший приоритет. Ну а потом можно либо на умолчание уходить либо эвристику уже пробовать. У японцев в HTTP все же нет кодировки.

https://www.w3.org/International/questions/qa-html-encoding-declarations

If you have access to the server settings, you should also consider whether it makes sense to use the HTTP header. Note however that, since the HTTP header has a higher precedence than the in-document meta declarations, content authors should always take into account whether the character encoding is already declared in the HTTP header. If it is, the meta element must be set to declare the same encoding.

You can detect any encodings sent by the HTTP header using the Internationalization Checker.

Да, кстати, Internationalization Checker тоже говорит, что в HTTP заголовках у япошек нет кодировки, есть в <meta> внутри страницы:

http://validator.w3.org/i18n-checker/check?uri=https://www.rakuten.co.jp#vali...

http://validator.w3.org/i18n-checker/check?uri=https://rakuten.co.jp#validate...

HTTP Content-Type 	No encoding information found 	Content-Type: text/html
Meta tag 	         utf-8 	                        <meta charset=«utf-8»/>

Вот именно поэтому не было преобразования.

Исходная версия Zubok, :

да, именно из-за этой эвристики я и начал использовать url-insert-file-contents

Ну, эвристика - вещь не очень красивая. В данном случае работает, но может не угадать. С однобайтными может не угадать. Я бы, конечно, делал процедуру, что сначала смотрел HTTP headers, а если там нет, то на <meta>, так как HTTP имеет больший приоритет. Ну а потом можно либо на умолчание уходить либо эвристику уже пробовать. У японцев в HTTP все же нет кодировки.

https://www.w3.org/International/questions/qa-html-encoding-declarations

<quote> If you have access to the server settings, you should also consider whether it makes sense to use the HTTP header. Note however that, since the HTTP header has a higher precedence than the in-document meta declarations, content authors should always take into account whether the character encoding is already declared in the HTTP header. If it is, the meta element must be set to declare the same encoding.

You can detect any encodings sent by the HTTP header using the Internationalization Checker. </quote>

Да, кстати, Internationalization Checker тоже говорит, что в HTTP заголовках у япошек нет кодировки, есть в <meta> внутри страницы:

http://validator.w3.org/i18n-checker/check?uri=https://www.rakuten.co.jp#vali...

http://validator.w3.org/i18n-checker/check?uri=https://rakuten.co.jp#validate...

HTTP Content-Type 	No encoding information found 	Content-Type: text/html
Meta tag 	         utf-8 	                        <meta charset=«utf-8»/>

Вот именно поэтому не было преобразования.