GNOME Bugzilla – Bug 671652
HTTP_ENVIRON locale contains whitespace
Last modified: 2013-01-04 20:46:44 UTC
Epiphany causes errors when visiting websites (such as http://main.g2.bx.psu.edu/ ) that parse locale settings such as 'en-us' via e.g. Babel (http://babel.edgewall.org/). It appears that sometimes ' en-us' is passed (including a prefix-whitespace). I'm running epiphany 3.0.4 on Ubuntu 11.10. A Babel-running site's specific debug message can be found below: File '[cut]/galaxy-central/eggs/Babel-0.9.4-py2.7.egg/babel/core.py', line 212 in parse return cls(*parse_locale(identifier, sep=sep)) File '[cut]/galaxy-central/eggs/Babel-0.9.4-py2.7.egg/babel/core.py', line 763 in parse_locale raise ValueError('expected only letters, got %r' % lang) ValueError: expected only letters, got ' en'
I guess we need to normalize the string we get.
Well apparently we are doing the right thing: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Epiphany sends: Accept-Language: en-gb, es-pe;q=0.90, en;q=0.80, es;q=0.70 Iceweasel and Chrome present themselves like this: Accept-Language: en-us,es-es;q=0.8,es;q=0.5,en;q=0.3 Accept-Language: en,es-419;q=0.8,es;q=0.6 Probably because this problem is not exclusive to Babel. Obviously the code in Babel is doing a string.split(",") and using the value without sanitizing: http://lists.bx.psu.edu/pipermail/galaxy-dev/2012-March/008885.html The problem, thus, is on both sides: · Babel should sanitize its strings, they can't cheerfully expect sane input from users. · Even if it does not follow the RFC, Epiphany should do what the other browsers do.
Created attachment 231571 [details] [review] e-embed-prefs: remove spaces in Accept-Language Some servers, like Babel, do not correctly sanitize the string in this header. They expect strings without spaces, even though the RFC includes them. Chrome and Firefox do not use spaces, presumably because many more websites break when using them.
Review of attachment 231571 [details] [review]: OK, if Chrome and Firefox do this let's go ahead.
Attachment 231571 [details] pushed as 7e764ea - e-embed-prefs: remove spaces in Accept-Language