Re: utf8 errors

From: Jiří Pavlovský <jiri(at)pavlovsky(dot)eu>
To: Alban Hertroys <haramrae(at)gmail(dot)com>
Cc: Jiří Pavlovský <jira33(at)gmail(dot)com>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: utf8 errors
Date: 2013-06-28 07:39:27
Message-ID: 51CD3DAF.8090301@pavlovsky.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28.6.2013 9:09, Alban Hertroys wrote:
> On Jun 26, 2013, at 16:58, Alban Hertroys <haramrae(at)gmail(dot)com> wrote:
>
>> On 26 June 2013 11:03, Jiří Pavlovský <jira33(at)gmail(dot)com> wrote:
>> On 26.6.2013 10:58, Albe Laurenz wrote:
>>> Jirí Pavlovský wrote:
>>>> I have a win32 application.
>>>> LOG: statement: INSERT INTO recipients (DealID,
>>>> Contactid) VALUES (29009, 9387)
>>>> ERROR: invalid byte sequence for encoding "UTF8": 0x9c
>>>>
>>>>
>>>> But the query is clean ascii and it doesn't even contain the mentioned
>>>> character.
>>>>
>>>> My database is in UNICODE, client encoding is utf8.
>>> Could you run the log message through "od -c" on a UNIX
>>> machine and post the result? Maybe there are some weird
>>> invisible bytes in there.
>>>
>>>
>> Hi,
>>
>> I've already tried that before posting. See below for results. Is the
>> message in the log the same as the message that postgres receives?
>>
>>
>> 0000000 I N S E R T I N T O r e c i
>> 0000020 p i e n t s ( D e a l I D ,
>> 0000040 C o n t a c t i d )
>> 0000060
>> 0000100 V A L U E S
>>
>>
>> What bytes are in the above between the closing brace and VALUES? Is that really white-space? Did you perhaps intentionally put white-space in between there?
> I just tested my theory that there may be garbage characters in your query string tripping the encoding error before a parse error:
>
> postgres=> \i /usr/bin/at
> psql:/usr/bin/at:15: ERROR: invalid byte sequence for encoding "UTF8": 0x80
>
> (/usr/bin/at is a UNIX command executable, for this case it works as binary data)
>
> Alban Hertroys
> --
> If you can't see the forest for the trees,
> cut the trees and you'll find there is no forest.
>

Hi, I've already found the problem - as could have been expected it was
due to a bug in my code. And the offending query was not the one above.
It was the next one, which did not get logged.
So, actually, you are right.

Thanks,

--
Jiří Pavlovský

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-06-28 08:04:56 Re: auto_explain & FDW
Previous Message Albe Laurenz 2013-06-28 07:35:14 Re: [HACKERS] Frontend/backend protocol improvements proposal (request).