Project

General

Profile

Actions

Bug #793

closed

Postgres backend doesn't set client encoding

Added by Kurt Roeckx over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
04/18/2011
Due date:
% Done:

0%

Estimated time:

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

Actions #1

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

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

Updated by Koen Deforche over 13 years ago

  • Target version set to 3.1.10
Actions #6

Updated by Koen Deforche over 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF