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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: convert(... using windows_1251_to_utf8) - works on cli, but not in a c prog.
Date: 2006-12-29 02:55:27
Message-ID: 20061229025527.GA29576@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Farber wrote:
> Hello Alvaro,
>
> On 12/24/06, Alvaro Herrera <alvherre(at)commandprompt(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-12-29 03:48:22 Re: questions about migrating form postgres 7 to 8
Previous Message Bob Pawley 2006-12-29 01:53:36 Re: Backup Restore