Re: Why do I get redirected to a German page?
| From: | Philip Newton | Date: | Sun, 30 Mar 2003 13:10:53 +0000 |
| Subject: | Re: Why do I get redirected to a German page? | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-16530@lists.php.net to get a copy of this message | ||
On 30 Mar 2003 at 13:35, Gabor Hojtsy wrote:
> > However, when I visit a CGI page I made which simply outputs the
> > environment variables it receives, it says
> >
> > HTTP_ACCEPT_LANGUAGE = en-GB,en,de
>
> From the RFC:
>
> | Each language-range MAY be given an associated quality value which
> | represents an estimate of the user's preference for the languages
> | specified by that range. The quality value defaults to "q=1".
>
> So your accept-language means equal importance for all three languages
> set. I don't see anything in the RFC specific about language order. The
> q values indicate the order.
Hm... you're right; I don't see anything about order being significant,
either (I'm assuming we're talking about RFC 2616 here -- HTTP/1.1).
In that case, I suppose the browser is wrong for not making the order
explicit with q values.
> BTW I don't see really why de comes first in your case after the
> parsing, because we have the languages in the right order and then
> usort() by quality,. which should not have the alphabetical order
> behaviour...
It depends on whether it's a stable or an unstable sort, doesn't it? If
it doesn't guarantee to keep the relative order when two elements have
the same sorting key, then you might get what happened here. (For
example, I believe qsort is, by default, unstable; two elements with
the same sort key may end up switched in the result.)
Cheers,
Philip
--
Philip Newton <Philip.Newton@gmx.net>