Lists: | pgsql-novice |
---|
From: | John Gage <jsmgage(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Entering a character code in a query |
Date: | 2010-03-08 16:24:09 |
Message-ID: | cd15286d1003080824r590bcb5exba6af73860dee445@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
I would like to use the following query:
SELECT english || '\n' || english || '\x2028' || french AS output FROM
vocab_words_translated;
where \x2028 is the hexadecimal code for a soft carriage return.
However, this does not work.
Can anyone help with this problem?
Thanking you,
John
Pertinent codes:
2028 LINE SEPARATOR * may be used to represent this semantic unambiguously
U+2028, character
, decimal 8232, hex 0x2028, octal \20050, binary
10000000101000 UTF-8: 0xe2 0x80 0xa8
From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Entering a character code in a query |
Date: | 2010-03-09 10:15:16 |
Message-ID: | hn573k$5pt$1@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On 2010-03-08, John Gage <jsmgage(at)gmail(dot)com> wrote:
> --001636e0a62bafd12a04814c7e13
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> I would like to use the following query:
>
> SELECT english || '\n' || english || '\x2028' || french AS output FROM
> vocab_words_translated;
>
> where \x2028 is the hexadecimal code for a soft carriage return.
>
> However, this does not work.
you need to express it in UTF-8 or turn on standard conforming strings
and use the unicode escape syntax.
http://www.postgresql.org/docs/8.4/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-UESCAPE
> 2028 LINE SEPARATOR * may be used to represent this semantic unambiguously
> U+2028, character =E2=80=A8=E2=80=AC, decimal 8232, hex 0x2028, octal \2005=
> 0, binary
> 10000000101000 UTF-8: 0xe2 0x80 0xa8
here it it in UTF-8
SELECT english || '\n' || english || E'\xe2\x80\xa8' || french AS output FROM
vocab_words_translated;