Locale::preferred may throw an exception but it's not caught in the framework default #386

Closed
greut opened this Issue Mar 20, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

greut commented Mar 20, 2012

A very long title for someting quite simple actually.

The default way of setting the locale using Locale::preferred() may throw an exception in the header is strangely formatted in Locale::decompose(). But this exception is not caught by default (in the framework).

A list of headers we've got that are breaking stuff, if you also want to improve the tests (we are using 0.10 with a defined set of available languages (fr, de), that you know):

  • ru, uk;q=0.8, be;q=0.8, en;q=0.7, *;q=0.01 (Yandex)
  • en;q=0.9,*;q=0.8 (Exabot)
  • de-DE,de;q=0.7,chrome://global/locale/intl.properties;q=0.3 (WTF!! UA being Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0)
  • fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3,x-ns14sRVhG$uNxh,x-ns2H71M1Oj6$be WTF
  • empty string (Java/1.6.0_31)
  • es-419,es;q=0.8 (Chrome 17.x.x.x)
Contributor

greut commented Mar 21, 2012

I wrote some tests on a branch: greut/lithium@UnionOfRAD:dev...386-locale-preferred Can someone take a look and give a feed about if they seem a correct behavior or not. Thanks!

greut added a commit to greut/lithium that referenced this issue Mar 24, 2012

Fix for the test cases added on Locale::preferred.
* It makes the regex more strict regarding what can define a language (Issue #386)

greut added a commit to greut/lithium that referenced this issue Mar 27, 2012

@ghost ghost assigned davidpersson Apr 19, 2012

Owner

nateabele commented Sep 15, 2012

The corresponding PR has been merged, so this is fixed.

@nateabele nateabele closed this Sep 15, 2012

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