Re: How can I insert a UTF-8 character with psql?

Поиск
Список
Период
Сортировка
От Roland Glenn McIntosh
Тема Re: How can I insert a UTF-8 character with psql?
Дата
Msg-id 5.1.0.14.2.20030613093614.05e9af88@lnxmain
обсуждение исходный текст
Ответ на Re: How can I insert a UTF-8 character with psql?  (Ian Barwick <barwick@gmx.net>)
Ответы Re: How can I insert a UTF-8 character with psql?  (Ian Barwick <barwick@gmx.net>)
Список pgsql-general
Ian - Thank you very much for your reply.  It only seems to half work, however.
This Euro sign is giving me a headache.
I tried both of the following:

        UPDATE my_tbl SET value='\40\254' WHERE NAME LIKE 'curr%';
and
        UPDATE my_tbl SET value=encode(decode('20ac','hex'), 'escape') WHERE NAME LIKE 'curr%';
and
        UPDATE my_tbl SET value='\040\254' WHERE NAME LIKE 'curr%';

Note that the documentation states this:
"Anything contained in single quotes is furthermore subject to C-like
substitutions for \n (new line), \t (tab), \digits, \0digits, and \0xdigits
(the character with the given decimal, octal, or hexadecimal code)."

That appears to just be incorrect.  Is there any form of this behavior that I can rely on in 7.3.3?  Note that the
"\254"part (AC in hex) appears to work correctly.  As far as I can tell, hex value AC is getting inserted.  It's the
"20"part I'm having difficulty with. 

Anyone have a solution for me?

-rgm


At 09:03 AM 06.13.2003 +0200, you wrote:
>On Friday 13 June 2003 00:13, Roland Glenn McIntosh wrote:
>> I would like to insert a EuroSign as two byte character number 20AC.
>> Is there a way I can do this from an ISO-8859-1 (latin1) terminal emulator
>> via the psql tool? Is there an entity scheme?
>>
>> I tried various permutations of the following to no avail:
>>       INSERT INTO mytable VALUES('currency_symbol','\u20AC');
>
>Use escaped octal codes:
>INSERT INTO my_tbl (unitxt) VALUES('\303\244')
>(replace '\303\244' with whatever 20AC is in octal), or if you prefer typing
>to maths:
>
>INSERT INTO my_tbl (unitxt) VALUES(encode(decode('c3a4','hex'), 'escape'))
>
>Ian Barwick
>barwick@gmx.net



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Insert NULL for ''
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: Insert NULL for ''