Re: Lossy character conversion to Latin-1

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Nis Jorgensen <nis(at)superlativ(dot)dk>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Lossy character conversion to Latin-1
Date: 2006-05-31 14:40:10
Message-ID: 19935E64-13C0-4F17-B2F9-580DC7DFCB82@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 31, 2006, at 9:17 AM, Nis Jorgensen wrote:

> regexp_replace seems to do what you need:
>
> http://www.postgresql.org/docs/8.1/static/functions-matching.html
>
> Something like
>
> regexp_replace (field, '[^\u0000-\u00FF]', '?', 'g')

Yes! Thanks very much -- I looked at that page several times and
missed regexp_replace.

Here is an example:

=== psql 3 ===
select regexp_replace('©«¡®£§¼½¾¿ ÀÉÌÓÙÝ àéìóùý
āŹźŻżŽž ∧∨ wxyz', '[^\\u0000-\\u00FF]', '?', 'g');
regexp_replace
------------------------------------------
©«¡®£§¼½¾¿ ÀÉÌÓÙÝ àéìóùý ??????? ?? wxyz
(1 row)

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nik 2006-05-31 14:45:38 Re: Insert into partition table hangs
Previous Message Tom Lane 2006-05-31 14:39:11 Re: PGSQL 7.4 -> 8.1 migration & performance problem