Re: Lossy character conversion to Latin-1

From: Nis Jorgensen <nis(at)superlativ(dot)dk>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Lossy character conversion to Latin-1
Date: 2006-05-31 09:17:48
Message-ID: 447D5F3C.7050801@superlativ.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John DeSoi wrote:
> I have a client that only supports Latin-1 and needs to connect to a
> UTF-8 database to retrieve some data. Some columns may contain
> characters that have no Latin-1 equivalent. I would like to convert
> these to a blank or perhaps some hex value. Is there any way to do this
> in PostgreSQL without using anything other than built in functions or
> pl/pgsql? It would be nice if the built in convert function had an
> option to handle this rather than only generating an error. Any pointers
> to an existing pl/pgsql function to perform this conversion?

You should be able to do this with regular expressions (substituting all
invalid chars) on the text columns of the result set(s). I write "should
be", since I don't remember the capabilities of pg regular expressions.

/Nis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2006-05-31 09:31:28 Re: UTF-8 context of BYTEA datatype??
Previous Message Alexander Scholz 2006-05-31 09:14:41 Re: Problem V8.1.4 - providing pwd for commandline tools doesn't