So it happened, we achieved to broke important existing application...
Sorry to hear that.
But your solution does the conversion twice (first one on database server side, and the second one in the application). To be honest, I don't see much sense in this solution. It would be much easier to give user a choice by adding new parameter to PostgreSQLSession::Open(const char *connect, bool autoconvert = false);
By default conversion can be turned off (for compatibility with older applications).
Another problem is in ErrorMessage function:
Now:
{
if(PQclientEncoding(conn) >= 0)
/* Client is connected, you should use FromCharset here */
return PQerrorMessage(conn);
/* Client is disconnected, use system code page */
return FromCharset(PQerrorMessage(conn));
}
Proposition:
{
if(PQclientEncoding(conn) >= 0)
return FromCharset(PQerrorMessage(conn))
return FromSystemCharset(PQerrorMessage(conn));
}