#23689: Django detects HTTP Accept-Language header in case-sensitive manner
--------------------------------------+--------------------
     Reporter:  wayneye               |      Owner:  nobody
         Type:  Bug                   |     Status:  new
    Component:  Internationalization  |    Version:  1.7
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+--------------------
 This issue was originally discussed in django-developers:
 https://groups.google.com/forum/#!topic/django-developers/1Y9LZSAOSnE

 Per [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 w3c],
 [http://tools.ietf.org/html/rfc2616#page-104 rfc2616] and
 [http://tools.ietf.org/html/bcp47 bcp47], Language tags should be parsed
 in case-insensitive, however, I noticed that Django detects HTTP Accept-
 Language headers in case-sensitive manner.

 For example, the following headers:

 {{{
 Chrome:   Accept-Language:  zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
 Firefox:  Accept-Language:  zh-tw,zh;q=0.8,en-us;q=0.5,en;q=0.3
 }}}

 Django will correctly display Traditional Chinese for Chrome, but won't
 for Firefox because of lower-cased TW.

 The fix contains two parts:
 1. Fix potential case-sensitive places in code to follow case-insensitive
 (for example parse_accept_lang_header())
 2. Fix [https://docs.djangoproject.com/en/dev/topics/i18n/#definitions
 documentation], correct the sentence "Browsers send the names of the
 languages they accept in the Accept-Language HTTP header using this
 format. Examples: it, de-at, es, pt-br. Both the language and the country
 parts are in lower case. ", which obviously incorrect, Chrome uses tags
 like zh-TW, pt-BR.

--
Ticket URL: <https://code.djangoproject.com/ticket/23689>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.1dac63261cac1fc4781c59bebcccca1c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to