473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

PLPERL function error - utf-8 to iso8859-1

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

---------------------------(end of broadcast)---------------------------TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Nov 12 '05 #1
3 2522
"Patrick Hatcher" <PH******@macys.com> writes:
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


AFAICT this means that the trademark symbol is not in the character set
that you've specified to be used in the database; accordingly there's no
need to try to prevent it from being stored...

Perhaps you should have selected the database encoding to be the same as
what you're using on the client side.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2

Ah there in lies the problem. I have my database encoding set to LATIN1
and I have this value stored in my table and can even write SQL to search
against it:
select *
from mdc_products
where description ~* '?'

Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-422-1610 office
HatcherPT - AIM

Tom Lane
<tg*@sss.pgh.p To: "Patrick Hatcher" <PH******@macys.com>
a.us> cc: pg***********@postgresql.org
Subject: Re: [GENERAL] PLPERL function error - utf-8 to iso8859-1
10/14/2003
09:07 PM

"Patrick Hatcher" <PH******@macys.com> writes:
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


AFAICT this means that the trademark symbol is not in the character set
that you've specified to be used in the database; accordingly there's no
need to try to prevent it from being stored...

Perhaps you should have selected the database encoding to be the same as
what you're using on the client side.

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #3

Ah there in lies the problem. I have my database encoding set to LATIN1
and I have this value stored in my table and can even write SQL to search
against it:
select *
from mdc_products
where description ~* '?'

Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-422-1610 office
HatcherPT - AIM

Tom Lane
<tg*@sss.pgh.p To: "Patrick Hatcher" <PH******@macys.com>
a.us> cc: pg***********@postgresql.org
Subject: Re: [GENERAL] PLPERL function error - utf-8 to iso8859-1
10/14/2003
09:07 PM

"Patrick Hatcher" <PH******@macys.com> writes:
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


AFAICT this means that the trademark symbol is not in the character set
that you've specified to be used in the database; accordingly there's no
need to try to prevent it from being stored...

Perhaps you should have selected the database encoding to be the same as
what you're using on the client side.

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Daniel Hansen | last post by:
I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name of the calling function? I want to do this for...
0
by: Joshua D. Drake | last post by:
Hello, There is now an updated version of plPerl with trigger support available at the Command Prompt community page. It can be viewed with documentation here:...
2
by: Christopher Murtagh | last post by:
Greetings, I'm trying to build 7.3.4 and I've come across two problems, one during the configure and the other afterward. Problem 1) Trying to build with openssl support gives this: ...
4
by: Ed L. | last post by:
I'm trying to load plperl to experiment with it in 7.3.4 with perl v5.8.0. I've basically tried the following: configure --with-perl, then initdb, then start postmaster, then createlang...
6
by: Gianni Mariani | last post by:
Before I go deep into this - does anyone have the quick fix for this ? Some facts - the 7.3.4 version of plperl.c has the same errors in the 7.4 tree. The 7.4 version of plperl.c (with some...
10
by: Robert Fitzpatrick | last post by:
I have plperl installed my PostgreSQL 7.4.2 server, but from what I understand in chapter 39.3 of the docs, you cannot access the databases without DBD::PgSPI. According to the readme for that...
3
by: Eric E | last post by:
Hi, I have an installation of Postgres 7.4.2 on SuSE 9.1. This version of SuSE comes with a binary for plperl and several other postgres procedural languages. All the others, including plpgsql...
0
by: rski | last post by:
I've installed postgres v. 8.2.4 with plperl support (--with-perl option with configure). But when I try to create plperl languge (createlang plperl) i've got an error createlang: language...
7
by: Charles | last post by:
I'm designing a C++ application for the web (with FastCGI) and it has to use UTF-8 because there will be users who will type Asian glyphs. When I compile the application, if I use ANSI, no problem,...
4
by: J Peyret | last post by:
Well, as usual I am confused by unicode encoding errors. I have a string with problematic characters in it which I'd like to put into a postgresql table. That results in a postgresql error so I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.