UTF-8 issue in Firefox - response header overriding meta tag?

只愿长相守 提交于 2019-12-01 22:33:43

The URL alias http://monthlymixup.com/mixups/july_2012/media/nick/Guessi-Gu%C3%A9r%C3%A9-Guessi%20%28Pop%20Bariba%29.mp3 works OK on Firefox, too. So the problem is appearently on the linking page. The problem can be reproduced using the following test page:

<!doctype html>
<title></title>
<meta charset=iso-8859-1>
<a href=
"http://monthlymixup.com/mixups/july_2012/media/nick/Guessi-Gu%e9r%e9-Guessi%20%28Pop%20Bariba%29.mp3"
>link</a>

Thus, the problem is in the PHP code that generates the linking page. It seems to % encode the letter “é” on its own, using the ISO-8859-1 based encoding %e9 instead of the proper UTF-8 based encoding.

Make sure that the linking page is generated correctly, with the letter “é” rather than any % encoded form or the UTF−8 based encoding %C3%A9.

It turns out that there was an issue with the Flash fallback in jPlayer. Firefox uses Flash to play the mp3.

Here's the fix from the developer of jPlayer:

Use the encodeURI(url) JavaScript command to encode the URL in JavaScript before passing the url to setMedia. For example:

$ ("#id").jPlayer("setMedia", {
   mp3: encodeURI("http://domain.com/audio/大地書房.mp3")
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!