pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reece Pegues <RPegues@tripwire.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14038: substring cuts unicode char in half, allowing to save broken utf8 into table
Date: Mon, 21 Mar 2016 17:10:45 +0000
Message-ID: <D315A115.2CF4F%rpegues@tripwire.com> (raw)
In-Reply-To: <22852.1458578790@sss.pgh.pa.us>
References: <20160321143927.2903.55302@wrigleys.postgresql.org>
	<22852.1458578790@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Looks like the database is created with ENCODING = 'SQL_ASCII'

So I assume it was thus saving the data that way, and then if the client
encoding is utf8 it tried to encode to that and failed?

-Reece

On 3/21/16, 12:46 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

>rpegues@tripwire.com writes:
>> We have a table with an update trigger where if you modify a certain
>>column,
>> we change the name of the row by calling a function.
>> In the function, substring() the name and then add a random string to
>>that. 
>> However, the substring appears to cut a unicode character in half, and
>>the
>> update trigger then updates the name with the broken string.
>
>That should not happen if Postgres knows it's dealing with unicode data.
>What have you got the database's encoding set to?
>
>			regards, tom lane




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <D315A115.2CF4F%rpegues@tripwire.com>
Permalink:  ../D315A115.2CF4F%25rpegues@tripwire.com/
Also on:    postgresql.org/message-id/D315A115.2CF4F%rpegues@tripwire.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: RPegues@tripwire.com, tgl@sss.pgh.pa.us
  Subject: Re: BUG #14038: substring cuts unicode char in half, allowing to save broken utf8 into table
  In-Reply-To: <D315A115.2CF4F%rpegues@tripwire.com>
  References: <20160321143927.2903.55302@wrigleys.postgresql.org> <22852.1458578790@sss.pgh.pa.us> <D315A115.2CF4F%rpegues@tripwire.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