remove strange character

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Gius
Participant
Posts: 29
Joined: Mon Mar 09, 2015 2:10 am

remove strange character

Post by Gius »

hello
in my job , i call a web service that return me in some field this : �
but i'm not able to remove this strange caracter
Someone know how to do this ?
thank you
Gius
Participant
Posts: 29
Joined: Mon Mar 09, 2015 2:10 am

Post by Gius »

Well

Convert("�", "", DSLink7.firstInitial)


this not work as when I paste the strange caracter in the transform, it paste

? instead �
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

You can try doing a double convert. Doing a copy paste may not work. In those cases, do have a look at that character in hex editor to identify it and then use Char() with decimal value of that character.

The character I can see here a unicode character used for replacement character with decimal code of 65533. Refer this link for details.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, the first step here is identification as in determining the actual ASCII value of the character. And then the next step is dealing with it properly, which isn't necessarily removal.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Gius
Participant
Posts: 29
Joined: Mon Mar 09, 2015 2:10 am

Post by Gius »

well I tried in a transform this :

if DSLink253.PER_FIRST_INITIAL = char ( 65533 ) then 'ok ' else 'ko'

but it always give my ko ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It needs to be identified, not guessed at. Do you have a way to get its actual value, perhaps by writing it to a file? Then a hex editor (or an octal dump on UNIX) would tell you what it is.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Gius
Participant
Posts: 29
Joined: Mon Mar 09, 2015 2:10 am

Post by Gius »

well it is exactly what "priyadarshikunal" wrote in is answer => �
it is what i see when i do a select in db2
when i do the oposite with seq () it give me the value 0
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You probably need to use the optional second argument of "allow8bits" for those functions to work properly with that value. Also wondering if there is a DB2 function equivalent to the Oracle DUMP function to get you the value via SQL.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

The character set encoding that the web service is using will determine how many bytes are used to encode that particular character.

It would be 3 bytes in UTF-8 (a variable width character set). It would be 2 bytes in UTF-16 (a fixed width character set).

You will have to use transform functions that work with unicode characters to work at the character level.

You may need to add the unicode extended property to your strings.

Mike
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the code point value is over 255 you will need UniChar() function rather than Char() function.

Code: Select all

 if DSLink253.PER_FIRST_INITIAL = unichar ( 65533 ) then 'ok ' else 'ko' 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply