Skip site navigation (1) Skip section navigation (2)

proposal: to_ascii(bytea)

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Postgres Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: to_ascii(bytea)
Date: 2008-06-26 15:40:13
Message-ID: 162867790806260840q22419d28g2b2544cc47c94732@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello,

Changes related to convert* functions in postgresql 8.3 has impact on
to_ascii function.

Before 8.3 I could do:
postgres=#  select to_ascii(convert('Příliš žlutý kůň' using
utf8_to_iso_8859_2),'latin2');
     to_ascii
------------------
 Prilis zluty kun
(1 row)

but convert_to function return bytea now, and I can't to call it
without unwanted changes in content of translated text.

postgres=# SELECT to_ascii(convert_to('Příliš žlutý kůň',
'latin2')::text,'latin2');
               to_ascii
---------------------------------------
 P\370\355li\271 \276lut\375 k\371\362
(1 row)

ugly hack for it:
postgres=# create function to_ascii(bytea, name) returns text as
'to_ascii_encname' language internal;
CREATE FUNCTION
postgres=#
postgres=# SELECT to_ascii(convert_to('Příliš žlutý kůň', 'latin2'),'latin2');
     to_ascii
------------------
 Prilis zluty kun
(1 row)

Regards
Pavel Stehule

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2008-06-26 16:02:50
Subject: Re: get_relation_stats_hook()
Previous:From: Ramya ChandrasekarDate: 2008-06-26 15:38:24
Subject: Re: Regd: TODO Item

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group