PLPERL function error - utf-8 to iso8859-1

From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PLPERL function error - utf-8 to iso8859-1
Date: 2003-10-14 23:17:53
Message-ID: OFB9C9923F.48B0B0D2-ON88256DBF.007F79F9-88256DBF.0080A484@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Trying to create a plperl function to strip non-friendly mainframe
characters from a string. However, when I try to add the Trademark symbol
(™) as a replace criteria, PG spits back an error:
ERROR: Could not convert UTF-8 to ISO8859-1
Any way I get around this?

CREATE OR REPLACE FUNCTION public.mainframe_description(varchar)
RETURNS varchar AS
'
my($desc) = @_;
$desc =~ s/®//g;
$desc =~ s//e/g;
$desc =~ s/ô/o/g;
$desc =~ s/æ/E/g;
$desc =~ s/Ò/ /g;
$desc =~ s/Ó/ /g;
$desc =~ s/è/e/g;
$desc =~ s/Ô//g;
$desc =~ s/É/E/g;
$desc =~ s/°//g;
$desc =~ s/é/e/g;
$desc =~ s/~Y//g;
$desc =~ s/Ö//g;
/*Error happens here */
$desc =~ s/™//g;
return $desc;
'
LANGUAGE 'plperl' VOLATILE;
COMMENT ON FUNCTION public.mainframe_description(varchar) IS 'Return a
clean description for mainframe input';

TIA

Patrick Hatcher

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edwin Quijada 2003-10-14 23:59:14 Re: Virtual Machines and postgres
Previous Message Mike Mascari 2003-10-14 22:51:17 Re: Question