Hi, I checked the HTTP1.1 protocol and it says:
3.10 Language Tags A language tag identifies a natural language spoken, written, or otherwise conveyed by human beings for communication of information to other human beings. Computer languages are explicitly excluded. HTTP uses language tags within the Accept-Language and Content- Language fields. The syntax and registry of HTTP language tags is the same as that defined by RFC 1766 [1]. In summary, a language tag is composed of 1 or more parts: A primary language tag and a possibly empty series of subtags: language-tag = primary-tag *( "-" subtag ) primary-tag = 1*8ALPHA subtag = 1*8ALPHA The definition of ALPHA is: UPALPHA = <any US-ASCII uppercase letter "A".."Z"> LOALPHA = <any US-ASCII lowercase letter "a".."z"> ALPHA = UPALPHA | LOALPHA White space is not allowed within the tag and all tags are case- insensitive. The name space of language tags is administered by the IANA. Example tags include: en, en-US, en-cockney, i-cherokee, x-pig-latin where any two-letter primary-tag is an ISO-639 language abbreviation and any two-letter initial subtag is an ISO-3166 country code. (The last three tags above are not registered tags; all but the last are examples of tags which could be registered in future.) >From some Linux manual: A locale name is typically of the form language[_territory][.codeset][@modifier], where language is an ISO 639 language code, territory is an ISO 3166 country code, and codeset is a character set or encoding identifier like ISO-8859-1 or UTF-8. So this is VERY confusing, because the HTTP protocol says that en-us or en-US is allowed, but most of the setlocale implementations only understand en_US (note the underbar). Therefore there are three ways we can fix this: 1) Ignore it and let users convert what is sent by the browser to something that their setlocale understands. 2) Force the php setlocale procedure to convert everything to the language_COUNTRY format before passing it to setlocale. 3) Modify configure.in so it calls setlocale to find out what is understood by the machine it's running on, then have the php setlocale code convert as appropriately. Any comment? Fab. ---- Original Message ----- From: "Markus Fischer" <[EMAIL PROTECTED]> To: "fabwash" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, April 13, 2002 12:16 AM Subject: Re: [PHP-DEV] setlocale > Interesting, I noticed this too. > > I would favour first to check why Microsoft uses a '-' > instead of '_' and if the mapping to the locales really is > always the same except the '-'. > > - Markus > > ps: I don't think this sort of check/hack belongs into PHP; > not without further investigation at least. > > On Sat, Apr 13, 2002 at 12:04:55AM -0400, fabwash wrote : > > Hi all, > > > > my browser (IE6) sends en-us in the HTTP_ACCEPT_LANGUAGE instead of the usual en_US. Would it be a good idea to modify setlocale (in ext/standard/string.c) so that it upshifts what is after the "-" before calling the local setlocale, or do you think that should be done by the user? > > > > Fab. > > -- > Please always Cc to me when replying to me on the lists. > GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc > "Mind if I MFH ?" "What QA did you do on it?" "the usual?" "ah... none :)" > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php