From: | Vilem Benjamin Liepelt <vileml(at)sqreamtech(dot)com> |
---|---|
To: | Sven Klemm <sven(at)timescale(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Hex escapes in strings only support ASCII range |
Date: | 2021-03-08 14:53:49 |
Message-ID: | 56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Thank you for the clarification, I misunderstood the documentation. Your explanation makes a lot of sense, my bad for opening a bug about this.
> On 8 Mar 2021, at 15:25, Sven Klemm <sven(at)timescale(dot)com> wrote:
>
> On Mon, Mar 8, 2021 at 2:43 PM Vilem Benjamin Liepelt
> <vileml(at)sqreamtech(dot)com> wrote:
>>
>> Escaped strings [1] fail on hex values greater than \x7f with a factually incorrect error message:
>>
>> $ psql --command "select E'\x80';"
>> ERROR: invalid byte sequence for encoding "UTF8": 0x80
>>
>> $ psql --version
>> psql (PostgreSQL) 13.1
>>
>> I was able to reproduce this bug on psql 10.
>>
>> Workaround:
>>
>> $ psql --command "select E'\u0080';"
>> ?column?
>> ----------
>> \u0080
>> (1 row)
>
> 0x80 is not equivalent to \u0080 in UTF8. You may use hex values
> greater than 0x7F but you still have to produce valid byte sequences
> for your target encoding or switch to an encoding that does not
> validate those sequences.
>
> postgres=# select E'\xc2\x80';
>
> ?column?
> ----------
> \u0080
> (1 row)
>
>
> --
> Regards, Sven Klemm
From | Date | Subject | |
---|---|---|---|
Next Message | Yaco312 | 2021-03-08 15:57:02 | Re: BUG #16774: PostgreSQL clean build MINGW64 gcc but initdb fails, cannot find startadress CreateProcessAsUserA |
Previous Message | Sven Klemm | 2021-03-08 14:25:15 | Re: Hex escapes in strings only support ASCII range |