Skip to content

Instantly share code, notes, and snippets.

@bortzmeyer
Created September 10, 2013 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bortzmeyer/6507603 to your computer and use it in GitHub Desktop.
Save bortzmeyer/6507603 to your computer and use it in GitHub Desktop.
Deux navigateurs identiques sur le même système d'exploitation, ont des résultats différents sur http://www.potamochère.fr/. Le premier double-encode le nom de fichier Unicode (et récupère donc un 404). Le second n'a pas de problème.
X.Y.Z.W - - [10/Sep/2013:10:22:36 +0000] "GET /potamoch%C3%83%C2%A8re.jpg HTTP/1.1" 404 257 "http://www.xn--potamochre-66a.fr/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0" www.xn--potamochre-66a.fr
X.Y.Z.T - - [10/Sep/2013:10:01:15 +0000] "GET /potamoch%C3%A8re.jpg HTTP/1.1" 200 254238 "http://www.xn--potamochre-66a.fr/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0" www.xn--potamochre-66a.fr
@vincib
Copy link

vincib commented Sep 10, 2013

Alors oui et non :

  • ton serveur web met un Content-Type: text/html sans préciser le charset
  • ton code HTML ne précise le charset que dans un élément <?xml, qui n'est pas forcément a propos ...

mon firefox voit donc une page dont il ne peut déterminer facilement le charset, et choisi ISO-8859-1 dans mon cas

je propose que tu ajoutes un ; charset=UTF-8 dans ton serveur web
ou un dans ton HTML.

PS: si je dis à mon firefox que la page est bel et bien en UTF-8, il n'a plus de problème et m'affiche bien l'image.

@bortzmeyer
Copy link
Author

Corrigé (charset ajouté aux deux endroits). Cela semble en effet avoir fait disparaître le problème.

Mais, normalement, UTF-8 devrait être la valeur par défaut. Grrr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment