Page 1 of 1

remove strange character

Posted: Tue Jun 09, 2015 4:01 am
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

Posted: Tue Jun 09, 2015 4:15 am
by Gius
Well

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


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

? instead �

Posted: Tue Jun 09, 2015 5:27 am
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.

Posted: Tue Jun 09, 2015 6:56 am
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.

Posted: Tue Jun 09, 2015 7:26 am
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 ...

Posted: Tue Jun 09, 2015 8:02 am
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.

Posted: Tue Jun 09, 2015 8:06 am
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

Posted: Tue Jun 09, 2015 8:49 am
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.

Posted: Tue Jun 09, 2015 9:28 am
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

Posted: Tue Jun 09, 2015 8:00 pm
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'