on 06-29-2011 5:23 PM
Dear all,
we received messages with value & # x 2 ; (without blanks) as content in one field.
I tried to replace it in mapping, but I am not able to load this message in mapping editor
as test message.
Is there a possibility to replace this characters e.g. with java mapping as first mapping to
replace it? Or is there no change to replace such special characters?
regards
chris
Edited by: Christian Riekenberg on Jun 29, 2011 6:25 PM
Hi Chris,
You should be able to copy paste these characters in test tab of message mapping since these are all printable characters. You can replace all of them in java mapping, if you are using one for your work. Here is a very simple UDF that you need to put across the fields in messages which you think can carry such characters.
public static String removeSpecialChar(String s)
{
try
{
int i,j;
String a="";
String stringSet[]={"& # x 2;","&#y3;","&#r2;"};
for(i=0;i<stringSet.length;++i)
{
j=s.indexOf(stringSet<i>);
while(j>=0)
{
a=s.substring(0,j);
a+=s.substring(stringSet<i>.length()+j);
s=a;
j=s.indexOf(stringSet<i>);
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
return s;
}
The input and output for this UDF is shown below
input=abcdef& # x 2;ghijk&#y3;lmno&#r2;pqrstuvwx&#r2;yz
output=abcdefghijklmnopqrstuvwxyz
You can see from here that there is a set of special character string I have used in UDF. Please remove the blanks between characters & # x 2 wherever you see them, since that causes printing errors in posts, so i had to include them.
String stringSet[]={"& # x 2;","&#y3;","&#r2;"};
you can reduce or increase this list as per your requirement to include all the special character set.
Hope this helps.
regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where do you get the messages from?
You should rather figure out, if you can remove the hex 02 value in sender application.
When you just remove the hex 02, then your message might be corrupt.
For example: your sending system has packed numbers, which are not translated to XML numbers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>Is there a possibility to replace this characters e.g. with java mapping as first mapping to
replace it? Or is there no change to replace such special characters?
Yes, it is possible to replace characters using java mapping as first mapping in the operation mapping.
Just curious Why dont filter out or resolve issues at the sender side itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.