RE: CAST from UTF8 to Unicode in SPL
Posted in 2006
Due to lack of response, I wrote a C UDR to do everything I needed to do
in unicode.
Alan
-----Original Message-----
From: informix-list-bounces@iiug.org
[mailto:informix-list-bounces@iiug.org] On Behalf Of Alan Treece
(atreece)
Sent: Thursday, October 12, 2006 10:38 AM
To: informix-list@iiug.org
Subject: CAST in SPL from NVARCHAR[1] to INT
Has anyone done this. I'm trying to get the numeric representation of a
unicode character.
DEFINE vpos int;
DEFINE vUnicodeStr NVARCHAR(128);
DEFINE vUnicodeValue int;
DEFINE vUniChar NVARCHAR(1);
DEFINE pFirstName varchar(64);
LET vpos = 1;
LET pFirstName = 'Alan';
LET vUnicodeStr = CAST(pFirstname AS NVARCHAR(128));
LET vUniChar= SUBSTR(vUnicodeStr, vpos, 1);
LET vUnicodeValue = CAST(vUniChar AS INT);
The last line generates this error. The docs talk about CAST only
working when the internal storage is the same. Otherwise a cast support
function is needed. I haven't found much on cast support functions that
would help me write one yet.
1213: Character to numeric conversion error Error in line 1 Nearcharacter position 1
[root@nw096a-82 root]# finderr 1213
-1213 A character to numeric conversion process failed.
A character value is being converted to numeric form for storage in a
numeric column or variable. However, the character string cannot be
interpreted as a number. It contains some characters other than white
space, digits, a sign, a decimal, or the letter e; or the parts are in
the wrong order, so the number cannot be deciphered.
If you are using NLS, the decimal character or thousands separator might
be wrong for your locale.
Any ideas appreciated,
Alan
_______________________________________________
Informix-list mailing list
Informix-list@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list