pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vilem Benjamin Liepelt <vileml@sqreamtech.com>
To: Sven Klemm <sven@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Hex escapes in strings only support ASCII range
Date: Mon, 8 Mar 2021 15:53:49 +0100
Message-ID: <56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com> (raw)
In-Reply-To: <CAMCrgp0yOayemnBNWjed6DvfW8H555PDs5Za80wnm-E2MW3_YA@mail.gmail.com>
References: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com>
	<CAMCrgp0yOayemnBNWjed6DvfW8H555PDs5Za80wnm-E2MW3_YA@mail.gmail.com>

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@timescale.com> wrote:
> 
> On Mon, Mar 8, 2021 at 2:43 PM Vilem Benjamin Liepelt
> <vileml@sqreamtech.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






view thread (3+ messages)

Message-ID: <56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com>
Permalink:  ../56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com/
Also on:    postgresql.org/message-id/56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: vileml@sqreamtech.com, sven@timescale.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Hex escapes in strings only support ASCII range
  In-Reply-To: <56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox