Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJHhE-00015P-Bc for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Mar 2021 15:21:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJHhB-0001gz-At for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Mar 2021 15:21:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJHGf-0005r4-LY for pgsql-bugs@lists.postgresql.org; Mon, 08 Mar 2021 14:53:57 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJHGa-0006M9-K1 for pgsql-bugs@lists.postgresql.org; Mon, 08 Mar 2021 14:53:56 +0000 Received: by mail-wr1-x429.google.com with SMTP id u14so11781061wri.3 for ; Mon, 08 Mar 2021 06:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sqreamtech-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ErI1Ka8Mncc98Yff21bXo7BG9b/e8VMXAGlXSO9nUYM=; b=pZIzO51JqzUtggFa0PDqVnQ6dg3Q2h3gM9Ck2VJbq7or1lkfFrtI5NtYXr7Zr6GU8y kn9BHm0ADWZv9Je1sgWc7AhOVNytp5TCDXx/KMZisZ//WCpNe+7Yyo2kcDnnY3XYq83F c1Q8ghpVSoFLS6y5EearB6njAJdYKA2DsNqLjMyZuqGQSpY1K/6i75hlUNKzM8sUbbT6 dK4yLOvsovkxkKhW6OVn1R2KoxuEPs6G3Z6oC4PtJvE2U9+TunoNHWinLbm2iPMa99kt 4wTL8MF6oNRBwhDX7yP+NvXKQDIidBVVbfjCBpEziWW3O0gvcYdKaO0OnzsrYoJstzgT 5Njw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ErI1Ka8Mncc98Yff21bXo7BG9b/e8VMXAGlXSO9nUYM=; b=InFKsQyOymz72PimkChmPHSJvX6GVGWZpiI9hfccpoOsvMj/jyrACav0e8Zf/lP1zO GbRfJTbggCfWHTK8bokR7M0LbNlSBnyi/VWwQvigLTRwbFSc22vYzYvoLvyWSzQvV8OB EkW1vHkgrK4hEJRoo0iVYodTeAuEqgyF+4Gjvj7QiTJXuGDAtt3l5YHi2i70btB7xyH9 hoWU01i3C8cmuAtNSfbwZ8Mlh1uNM2v4UO0Ywq9hyBsA/NC5aBMn0hYt9yQVGHjGXUJH 8nnadMtiMME+g6qnZe0eAw7Fu2te5HjjzWM4ewnsPF5MLOCovycJNOLL/GmvJix++a9h /8hA== X-Gm-Message-State: AOAM5313SokkNGSY+/6GCBFNErDTW/TdTLQgRMZ2tp95W3WUx82lSC6N LuAL+F6UZzxXWwEeGJjev5lHbw== X-Google-Smtp-Source: ABdhPJwnjkoL78pZ1c4D2a9YYIymvFWg0Fdi29csvi4/O8fzsIzWDdKSpP/m9+qvUVoF1OM2MhH5wA== X-Received: by 2002:a5d:6412:: with SMTP id z18mr23506698wru.214.1615215231202; Mon, 08 Mar 2021 06:53:51 -0800 (PST) Received: from [192.168.2.101] (p5b154017.dip0.t-ipconnect.de. [91.21.64.23]) by smtp.gmail.com with ESMTPSA id c9sm18948223wmb.33.2021.03.08.06.53.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Mar 2021 06:53:50 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: Hex escapes in strings only support ASCII range From: Vilem Benjamin Liepelt In-Reply-To: Date: Mon, 8 Mar 2021 15:53:49 +0100 Cc: pgsql-bugs@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <56A4E8CC-2CC3-4FD9-8071-27834FE04512@sqreamtech.com> References: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com> To: Sven Klemm X-Mailer: Apple Mail (2.3654.60.0.2.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 wrote: >=20 > On Mon, Mar 8, 2021 at 2:43 PM Vilem Benjamin Liepelt > wrote: >>=20 >> Escaped strings [1] fail on hex values greater than \x7f with a = factually incorrect error message: >>=20 >> $ psql --command "select E'\x80';" >> ERROR: invalid byte sequence for encoding "UTF8": 0x80 >>=20 >> $ psql --version >> psql (PostgreSQL) 13.1 >>=20 >> I was able to reproduce this bug on psql 10. >>=20 >> Workaround: >>=20 >> $ psql --command "select E'\u0080';" >> ?column? >> ---------- >> \u0080 >> (1 row) >=20 > 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. >=20 > postgres=3D# select E'\xc2\x80'; >=20 > ?column? > ---------- > \u0080 > (1 row) >=20 >=20 > -- > Regards, Sven Klemm