Re: [GENERAL] trouble with to_char('L')
| От | Takahiro Itagaki |
|---|---|
| Тема | Re: [GENERAL] trouble with to_char('L') |
| Дата | |
| Msg-id | 20100312155207.968B.52131E4D@oss.ntt.co.jp обсуждение исходный текст |
| Ответ на | Re: [GENERAL] trouble with to_char('L') (Bruce Momjian <bruce@momjian.us>) |
| Ответы |
Re: [GENERAL] trouble with to_char('L')
|
| Список | pgsql-hackers |
Bruce Momjian <bruce@momjian.us> wrote:
> OK, I have created a new function, win32_wchar_to_db_encoding(), to
> share the conversion from wide characters to the database encoding.
> New patch attached.
Since 9.0 has GetPlatformEncoding() for the purpose, we could simplify
db_encoding_strdup() with the function. Like this:
static char *
db_encoding_strdup(const char *str)
{char *pstr;char *mstr;
/* convert the string to the database encoding */pstr = (char *) pg_do_encoding_conversion(
(unsignedchar *) str, strlen(str), GetPlatformEncoding(), GetDatabaseEncoding());mstr =
strdup(pstr);if(pstr != str) pfree(pstr);
return mstr;
}
I beleive the code is harmless on all platforms and we can use it
instead of strdup() without any #ifdef WIN32 quotes.
BTW, I found we'd better to add "ANSI_X3.4-1968" as an alias for
PG_SQL_ASCII. My Fedora 12 returns the name when --no-locale is used.
Regards,
---
Takahiro Itagaki
NTT Open Source Software Center
В списке pgsql-hackers по дате отправления: