Re: [HACKERS] Locale + encoding combinations

2007-10-12 Thread Magnus Hagander
On Fri, Oct 12, 2007 at 06:03:52AM -0700, Trevor Talbot wrote: > On 10/12/07, Dave Page <[EMAIL PROTECTED]> wrote: > > Tom Lane wrote > > > That still leaves us with the problem of how to tell whether a locale > > > spec is bad on Windows. Judging by your example, Windows checks whether > > > the

Re: [HACKERS] Locale + encoding combinations

2007-10-12 Thread Dave Page
Trevor Talbot wrote: > The encoding output is the one you specified. OK. > Keep in mind, > underneath Windows is mostly working with Unicode, so all characters > exist and the locale rules specify their behavior there. The encoding > is just the byte stream it needs to force them all into afte

Re: [HACKERS] Locale + encoding combinations

2007-10-12 Thread Trevor Talbot
On 10/12/07, Dave Page <[EMAIL PROTECTED]> wrote: > Tom Lane wrote > > That still leaves us with the problem of how to tell whether a locale > > spec is bad on Windows. Judging by your example, Windows checks whether > > the code page is present but not whether it is sane for the base locale. > >

Re: [HACKERS] Locale + encoding combinations

2007-10-12 Thread Dave Page
Tom Lane wrote > That still leaves us with the problem of how to tell whether a locale > spec is bad on Windows. Judging by your example, Windows checks whether > the code page is present but not whether it is sane for the base locale. > What happens when there's a mismatch --- eg, what encoding d

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > ... There is another issue > though as I mentioned in the post above - that it complains about an > invalid encoding specifier on the encoding name, then ignores it and > uses the default which seems wrong to me. Yeah, if you look at chklocale() in initdb.c

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > In fact, it looks like it'll allow me to use anything thats installed, > regardless of whether they're liekly to be compatible. So much for > trusting setlocale() :-( Yech :-(. Count on Microsloth to get this wrong. Anyone have any ideas on how to tell if

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Tom Lane wrote: > Dave Page <[EMAIL PROTECTED]> writes: >> OK so I added the appropriate entries (and posted the patch to >> -patches), but my original question remains: why can I only select the >> *default* encoding for the chosen locale, but not other ones that are >> also be valid according to

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > OK so I added the appropriate entries (and posted the patch to > -patches), but my original question remains: why can I only select the > *default* encoding for the chosen locale, but not other ones that are > also be valid according to setlocale? Is this a b

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Tom Lane wrote: > Dave Page <[EMAIL PROTECTED]> writes: >> Tom Lane wrote: >>> Are you certain that that acceptance actually represents support? >>> Have you checked that it rejects combinations involving real code >>> pages (ie, NOT 65001) that don't really work with the locale? > >> It fails wit

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Are you certain that that acceptance actually represents support? >> Have you checked that it rejects combinations involving real code >> pages (ie, NOT 65001) that don't really work with the locale? > It fails with ones that Microsoft hav

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Tom Lane wrote: > Dave Page <[EMAIL PROTECTED]> writes: >> However, setlocale() will also accept other valid combinations on >> Windows, which initdb will not, for example: >> "English_United Kingdom.28591" (Latin1) >> Is there any reason not to accept other combinations that setlocale() is >> happ

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Peter Eisentraut wrote: > Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: >> my original question remains: why can I only select the >> *default* encoding for the chosen locale, but not other ones that are >> also be valid according to setlocale? Is this a bug, or is there some >> technical reason

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Tom Lane
Dave Page <[EMAIL PROTECTED]> writes: > However, setlocale() will also accept other valid combinations on > Windows, which initdb will not, for example: > "English_United Kingdom.28591" (Latin1) > Is there any reason not to accept other combinations that setlocale() is > happy with? Are you certai

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Peter Eisentraut
Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: > my original question remains: why can I only select the > *default* encoding for the chosen locale, but not other ones that are > also be valid according to setlocale? Is this a bug, or is there some > technical reason? One locale works only with

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Dave Page wrote: > Peter Eisentraut wrote: >> Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: >>> So is it just a case of us generating a list of matches that may be >>> Windows specific, or is there more to it than that? >> You want to peruse src/port/chklocale.c. There is already explicit Windo

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Peter Eisentraut wrote: > Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: >> So is it just a case of us generating a list of matches that may be >> Windows specific, or is there more to it than that? > > You want to peruse src/port/chklocale.c. There is already explicit Windows > support in the

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Peter Eisentraut
Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: > So is it just a case of us generating a list of matches that may be > Windows specific, or is there more to it than that? You want to peruse src/port/chklocale.c. There is already explicit Windows support in there, so maybe you just need to add

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Peter Eisentraut wrote: > Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: >> Latin1 is a perfectly valid encoding for my locale English_United >> Kingdom. It is accepted by setlocale for LC_ALL. >> >> Why does initdb reject it? Why does it insist the encoding is not valid >> for the locale? > > B

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Peter Eisentraut
Am Mittwoch, 10. Oktober 2007 schrieb Dave Page: > Latin1 is a perfectly valid encoding for my locale English_United > Kingdom. It is accepted by setlocale for LC_ALL. > > Why does initdb reject it? Why does it insist the encoding is not valid > for the locale? Because initdb works with a finite l

Re: [HACKERS] Locale + encoding combinations

2007-10-10 Thread Dave Page
Peter Eisentraut wrote: > Dave Page wrote: >> setlocale(LC_CTYPE, "English_United Kingdom.65001") >> >> will return null (and not change anything) because it doesn't like >> the combination of the locale and that encoding (UTF-8). > > The reason that that call fails is probably that the operating

Re: [HACKERS] Locale + encoding combinations

2007-10-09 Thread Peter Eisentraut
Dave Page wrote: > setlocale(LC_CTYPE, "English_United Kingdom.65001") > > will return null (and not change anything) because it doesn't like > the combination of the locale and that encoding (UTF-8). The reason that that call fails is probably that the operating system does not provide such a lo

Re: [HACKERS] Locale + encoding combinations

2007-10-09 Thread Dave Page
Peter Eisentraut wrote: > Dave Page wrote: >> Is there any reason not to accept other combinations that setlocale() >> is happy with? > > setlocale() sets the locale. How does it "accept" a "combination"? > setlocale(LC_CTYPE, "English_United Kingdom.65001") will return null (and not change an

Re: [HACKERS] Locale + encoding combinations

2007-10-09 Thread Peter Eisentraut
Dave Page wrote: > Is there any reason not to accept other combinations that setlocale() > is happy with? setlocale() sets the locale. How does it "accept" a "combination"? -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)---