Chrome use in HTTP_ACCEPT_LANGUAGE upper case letters.
Cause oh this the regex failes to determine the priorety of these languages

attached patch fix this issue.

Comments

Status: Needs review » Needs work

The last submitted patch, browser_language_detection.patch, failed testing.

flaviovs’s picture

Version: 6.19 » 6.26
Priority: Normal » Major
StatusFileSize
new757 bytes

This issue affects mostly those whose default language tag are on the "xx-yy" form, such as "pt-BR" , "en-CA" etc. So I'm afraid that this is the cause this long lasting bug is still present.

Notice that Drupal is wrong in expecting only lowercase language tags as RFC 2616 Sec. 3.1 clearly states that "all [language] tags are case- insensitive".

This is a major issue as it breaks expected behavior. The bug is gaining exposition because some new browsers (e.g Chrome) send the country part in upper case, which makes the "Accept-Language" test fail, as pointed by Greenrover33.

Fortunately the fix is straightforward. Attached is a new simplified patch against 6.26. It just add the "i" (ignore case) flag to the test regexp.

damien tournoud’s picture

Status: Needs work » Closed (duplicate)

There is more then that broken in this function. We should consider backporting #221712: locale_language_from_browser() doesn't parse language tags correctly, has a broken logic. Marking as duplicate.

flaviovs’s picture

Status: Closed (duplicate) » Closed (fixed)

Damien,

I understand that the language detection system need an overhaul, which was already done in D7. However, I'm afraid that such big change may not come do D6 in a near future.

In the meantime, expected behavior is broken, which is a major issue.

Perfection is the worst enemy of good solutions. The fix is just a straightforward 1-byte change, so I fail to understand why we cannot be more pragmatic here, apply the fscking patch, and close this long standing issue?

flaviovs’s picture

Status: Closed (fixed) » Active

Fixing unintentional status change from last post. Reopening as I think is more appropriate. Feel free to duplicate-close it if you think that the questions raised in my last post shouldn't be considered.

Sorry for the confusion.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.