psql '\copy to' and unicode escapes

From: Steven Hirsch <snhirsch(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: psql '\copy to' and unicode escapes
Date: 2018-02-26 16:53:15
Message-ID: CABUrQ4xn4JMKaaEcQXHHV7Q34F6+ZQQZh4rhhwy+wabSEG_pjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I fear that I'm missing something very obvious, but I cannot find a syntax
that permits me to use an escaped hexadecimal representation in a CSV file
and have that representation interpreted as the equivalent unicode
character when inserting into the database. Both client and server are
using UTF8 encoding.

For example, trying to insert the 'degree' symbol, I've tried:

U&"\00b0"
E'\00b0'
"\u00b0"

In all cases, I simply get the literal string in the table, not the desired
unicode character.

If I use them in an 'INSERT' statement, it works properly. The problem is
almost certainly between the chair and the keyboard, but what am I
misunderstanding?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-02-26 17:05:37 Re: psql '\copy to' and unicode escapes
Previous Message Łukasz Jarych 2018-02-26 16:36:48 Re: Creating complex track changes database - challenge!