Bug #793
closedPostgres backend doesn't set client encoding
0%
Description
Hi,
It seems that the postgres backend doesn't call PQsetClientEncoding(), and then probably assumes the client encoding is set to UTF-8. I at least get errors that widen() fails for strings that contain non-ASCII (latin1) characters. I assume they will go away when the proper client encoding is set.
Kurt
Updated by Koen Deforche over 13 years ago
- Status changed from New to Resolved
Hey,
Indeed, we are assuming UTF8. I've added a:
PQsetClientEncoding(conn_, "UTF8");
I couldn't find accurate documentation saying it would need to be "UTF8" or "UTF-8" but I do not get any warnings/errors from the database. So you might want to try if it fixes the issue for you ?
Regards,
koen
Updated by Kurt Roeckx over 13 years ago
Koen Deforche wrote:
Hey,
Indeed, we are assuming UTF8. I've added a:
[...]I couldn't find accurate documentation saying it would need to be "UTF8" or "UTF-8" but I do not get any warnings/errors from the database. So you might want to try if it fixes the issue for you ?
As far as I can see both are valid, but I think "UTF8" is the preferred way.
Anyway, the git repository hasn't changed the past 2 weeks.
Kurt
Updated by Kurt Roeckx over 13 years ago
Koen Deforche wrote:
So you might want to try if it fixes the issue for you ?
So I just tried the current git snapshot. With the old version I got a "?" on the web page and a latin1 string in the error log, now I get "??" instead, and an utf-8 string in the log.
So the original problem I reported seems to be solved, but there is some other problem left.
Should I somehow set locale or something? That doesn't make sense to me, and so always setting it to UTF8 was wrong.
Or is there a call too much to toUTF8()?
Kurt
Updated by Kurt Roeckx over 13 years ago
Kurt Roeckx wrote:
Koen Deforche wrote:
> So you might want to try if it fixes the issue for you ?So I just tried the current git snapshot. With the old version I got a "?" on the web page and a latin1 string in the error log, now I get "??" instead, and an utf-8 string in the log.
So the original problem I reported seems to be solved, but there is some other problem left.
Should I somehow set locale or something? That doesn't make sense to me, and so always setting it to UTF8 was wrong.
Or is there a call too much to toUTF8()?
So I started using a Wt::WString instead std::string and that solved everything.
When converting a std::string to a Wt::WString I also always have to say it's an UTF8 string, else the conversion isn't working properly.
Kurt
Updated by Koen Deforche over 13 years ago
- Status changed from Resolved to Closed