Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread Joshua D. Drake
John DeSoi wrote: On May 31, 2006, at 10:40 AM, John DeSoi wrote: Yes! Thanks very much -- I looked at that page several times and missed regexp_replace. Ok, now I know why I missed it. regexp_replace is only in PostgreSQL 8.1 and later. I'm stuck with 8.0 for hosting at the moment. I'm

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread Tatsuo Ishii
> > It should be easy to write user defined funtion and define your own > > CONVERSION. CREATE CONVERSION is your friend. > > It looks like CREATE CONVERSION requires a C function to do the > conversion. This will be used in a hosted environment -- I won't be > able to add any C language func

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread John DeSoi
On May 31, 2006, at 10:40 AM, John DeSoi wrote: Yes! Thanks very much -- I looked at that page several times and missed regexp_replace. Ok, now I know why I missed it. regexp_replace is only in PostgreSQL 8.1 and later. I'm stuck with 8.0 for hosting at the moment. I'm sure it is not ve

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread John DeSoi
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, '[^\u-\u00FF]', '?', 'g') Yes! Thanks very much -- I looked at that page several times and

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread John DeSoi
On May 31, 2006, at 9:26 AM, Tatsuo Ishii wrote: It should be easy to write user defined funtion and define your own CONVERSION. CREATE CONVERSION is your friend. It looks like CREATE CONVERSION requires a C function to do the conversion. This will be used in a hosted environment -- I won'

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread Tatsuo Ishii
> 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 Postgr

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread John DeSoi
On May 31, 2006, at 5:17 AM, Nis Jorgensen wrote: 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. I thought about this

Re: [GENERAL] Lossy character conversion to Latin-1

2006-05-31 Thread Nis Jorgensen
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 P

[GENERAL] Lossy character conversion to Latin-1

2006-05-30 Thread John DeSoi
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 witho