I have a page with the following meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
I thought this would set the default character set to UTF-8 and indeed it appears to in Chrome and Safari, but not in Firefox.
I have a PHP script on the page which generates a playlist of audio files for jPlayer, and filenames with accents in characters aren't working/playing in Firefox.
Here is the error message I am seeing in the Firebug console:
As you can see the characters in the filename aren't getting read correctly. The filename should be "Guessi-Guéré-Guessi (Pop Bariba)"
When I then look for more detail on the error, under the "Headers" tab I see this:
Which shows that the charset is iso-8859-1. Then in the "Response" tab I see:
Which confirms the error, but this time with the correct encoding showing. The file definitely exists, and as I say it plays/works in other browsers.
So I am presuming the issue is to do with the response headers getting set differently in Firefox, and overriding the meta tag. I have checked the response headers in Chrome, and they are indeed set to UTF-8. What can I do to fix this?
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:
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: