Re: convert(... using windows_1251_to_utf8) - works on cli, but not in a c prog. - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: convert(... using windows_1251_to_utf8) - works on cli, but not in a c prog.
Date
Msg-id 20061229025527.GA29576@alvh.no-ip.org
Whole thread Raw
In response to Re: convert(... using windows_1251_to_utf8) - works on cli, but not in a c prog.  ("Alexander Farber" <alexander.farber@gmail.com>)
List pgsql-general
Alexander Farber wrote:
> Hello Alvaro,
>
> On 12/24/06, Alvaro Herrera <alvherre@commandprompt.com> wrote:
> >Alexander Farber wrote:
> >> I started to prepare a test case and realized I had a bug.
> >> So convert() works for me, sorry for my previous message!
> >
> >In any case, it's probably saner if you SET client_encoding at the start
> >of the session instead of using convert() everywhere.  The
> >server_encoding should be correctly set to Win1251 though!  (Using
> >SQL_ASCII, while not technically incorrect, is probably not doing you
> >any favor).
>
> thanks for your comment! I've dropped my db
> and recreated it with encoding set to WIN1251:

Well, what I was suggesting (not explicitely enough, now that I look)
was that you SET client_encoding to UTF8, and then use the query this
way:

> #define SQL_FETCH_USER          \
>    "select username, " \
>    "user_avatar from phpbb_users where user_active = 1 " \
>    "and user_id = $1 and user_password = $2 and user_id not in " \
>    "(select ban_userid from phpbb_banlist where ban_userid is not null)"

Good to hear that it worked anyway.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: Bob Pawley
Date:
Subject: Re: Backup Restore
Next
From: "karthik"
Date:
Subject: could not open relation:no such file or directory