|
|
Home » U++ Library support » U++ SQL » Postgres library improvements
|
|
Re: Postgres library improvements [message #22600 is a reply to message #22595] |
Wed, 29 July 2009 14:52 |
Zbych
Messages: 325 Registered: July 2009
|
Senior Member |
|
|
luzr wrote on Wed, 29 July 2009 08:40 | Thanks, applied. I hope this will not cause any trouble (but it seems quite reasonable)
|
I see two possible sources of troubles:
1. not all code page names from CharsetName() are accepted by postgres (that is why I've added ASSERT). Code page names: iso8859-xx, windows-125x, koi8-r, UTF-8 are accepted and cp852, mjk, cp850 are rejected.
2. I don't know what code page is used before connection is established (in my case all messages at this time are in english, probably because of this bug ).
[Updated on: Wed, 29 July 2009 15:21] Report message to a moderator
|
|
|
Re: Postgres library improvements [message #22606 is a reply to message #22561] |
Thu, 30 July 2009 22:12 |
Zbych
Messages: 325 Registered: July 2009
|
Senior Member |
|
|
I've made some additional tests and it appears that code page and client language are one big mess in windows version of postgresql:
1. Before client is connected, error messages (for example when server is down) use win-1250 code page (environment variable LC_LOCALE is ignored, bug)
2. When client tries to connect, but connection is refused (for example when client has no right to connect to database), error messages use code page and language set in configuration of server (in my case utf-8)
3. When client is connected and code page is set by PQsetClientEncoding, error messages use correct code page.
I tried to fix the problem:
String PostgreSQLSession::ErrorMessage()
{
if (PQclientEncoding(conn) >= 0) return PQerrorMessage(conn);
return FromSystemCharset(PQerrorMessage(conn));
}
but it only solves case 1 i 3.
Any ideas how to handle this correctly?
[Updated on: Thu, 30 July 2009 22:12] Report message to a moderator
|
|
|
Re: Postgres library improvements [message #22607 is a reply to message #22606] |
Fri, 31 July 2009 10:22 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Zbych wrote on Thu, 30 July 2009 16:12 | I've made some additional tests and it appears that code page and client language are one big mess in windows version of postgresql:
1. Before client is connected, error messages (for example when server is down) use win-1250 code page (environment variable LC_LOCALE is ignored, bug)
2. When client tries to connect, but connection is refused (for example when client has no right to connect to database), error messages use code page and language set in configuration of server (in my case utf-8)
3. When client is connected and code page is set by PQsetClientEncoding, error messages use correct code page.
I tried to fix the problem:
String PostgreSQLSession::ErrorMessage()
{
if (PQclientEncoding(conn) >= 0) return PQerrorMessage(conn);
return FromSystemCharset(PQerrorMessage(conn));
}
but it only solves case 1 i 3.
Any ideas how to handle this correctly?
|
For now, patch applied.
I guess that perhaps the issue is not that serious. error messages tend to be in basic ascii, especially connection messages.
Moreover, you do not expect regular users to understand them anyway...
Mirek
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 20 11:39:33 CEST 2024
Total time taken to generate the page: 0.03228 seconds
|
|
|