From: | Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] trouble with to_char('L') |
Date: | 2010-04-19 01:59:42 |
Message-ID: | 20100419105942.A6B4.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> But I'm unsure how that would work. We're talking about the output of
> localeconv(), right? I don't see a version of localeconv() that does
> wide chars anywhere. (You can't just set LC_CTYPE and use the regular
> function - Windows has a separate set of functions for dealing with
> UTF16).
Yeah, msvcrt doesn't have wlocaleconv :-( . Since localeconv() returns
characters in the encoding specified in LC_TYPE, we need to hande the
issue with codes something like:
1. setlocale(LC_CTYPE, lc_monetary)
2. setlocale(LC_MONETARY, lc_monetary)
3. lc = localeconv()
4. pg_do_encoding_conversion(lc->xxx,
FROM pg_get_encoding_from_locale(lc_monetary),
TO GetDatabaseEncoding())
5. Revert LC_CTYPE and LC_MONETARY.
Another idea is to use GetLocaleInfoW() [1], that is win32 native locale
functions, instead of the libc one. It returns locale characters in wide
chars, so we can safely convert them as UTF16->UTF8->db. But it requires
an additional branch in our locale codes only for Windows.
[1] http://msdn.microsoft.com/en-us/library/dd318101
Regards,
---
Takahiro Itagaki
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Đỗ Ngọc Trí Cường | 2010-04-19 02:26:53 | Help with tracking! |
Previous Message | Vick Khera | 2010-04-19 01:27:26 | Re: partitioned lookup table? |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-04-19 02:04:50 | Re: master in standby mode croaks |
Previous Message | Fujii Masao | 2010-04-19 01:58:05 | Re: master in standby mode croaks |