473,799 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.mainfram e_description(v archar)
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.mainfram e_description(v archar) 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 2557
"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***********@p ostgresql.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***********@p ostgresql.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
25096
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 error reporting purposes without having to hardcode the function name into my scripts. Say the function is named getFunctionName(). I want to do something like... function foo() {
0
1089
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: https://www.commandprompt.com/entry.lxp?lxpe=285 Sincerely, Joshua Drake
2
5291
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: ../configure --with-openssl --enable-odbc --with-perl --enable-multibyte
4
3795
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 plplerl template1 No matter what I try, I keep getting this error:
6
1376
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 error handling API calls commented out) compiles fine in the 7.3.4 tree. (Same machine - same install of perl !) Points to using some alternate perl API probably by macro collision ?
10
1531
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 module, it will only run on the untrusted plperlu. Is this the only way to run queries (SELECT, INSERT, UPDATE) using plperl? What are the consequences and things to look out for when running untrusted languages?
3
3698
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 install without a problem, but executing: createlang -u postgres plperl template1 produces the result: createlang: language installation failed: ERROR: could not load library "/usr/lib/postgresql/plperl.so": libperl.so: cannot open shared object...
0
2576
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 installation failed: ERROR: could not load library "/usr/ocal/pgsql/lib/plperl.so": /usr/local/pgsql/lib/plperl.so: undefined symbol: Perl_croak can somebody explain where the problem is. File /usr/local/pgsql/plperl.so exists.
7
5035
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, it compiles properly. But if I save the files as UTF-8, I get this error message: %g++ -o cgi-bin/test.fcgi test.cpp test.csp.cpp:1: error: stray '\239' in program test.csp.cpp:1: error: stray '\187' in program test.csp.cpp:1: error: stray...
4
8257
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 am trying to fix things with <string>.encode he Company�s ticker Trying for an encode:
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.