on 04-04-2008 2:25 PM
Requirement is to Convert UTF-8 encoded Speciual language characters to HTML Entity Escape Character's. For example In the source I have a Description field with value "Caractéristiques" which is 'Characteristics' in French, This needs to be converted to "Caractéristiques" when sent to the Reciever.i.e the Special Language Symbols like é = é (in HTML Entity format.)
Below is the Link for a List of HTML Entity Char's
http://www.theukwebdesigncompany.com/articles/article.php?article=11
could anybody please suggest how this can be achieved in mapping...any UDF or Encoding techniques...?
many Thanks.
Hi Veera
this is ajay
code for ur problem
String ToHTMLEntity(String s) {
StringBuffer sb = new StringBuffer(s.length());
boolean lastWasBlankChar = false;
int len = s.length();
char c;
for (int i = 0; i < len; i++) {
c = s.charAt(i);
if (c == ' ') {
if (lastWasBlankChar) {
lastWasBlankChar = false;
sb.append(" ");
} else {
lastWasBlankChar = true;
sb.append(' ');
}
} else {
lastWasBlankChar = false;
//
// HTML Special Chars
if (c == '"')
sb.append(""");
else if (c == '&')
sb.append("&");
else if (c == '<')
sb.append("<");
else if (c == '>')
sb.append(">");
else if (c == '
')
// Handle Newline
sb.append("<br/>");
else {
int ci = 0xffff & c;
if (ci < 160)
sb.append(c);
else {
sb.append("&#");
sb.append(new Integer(ci).toString());
sb.append(';');
}
}
}
}
return sb.toString();
}
rewrd points if it help u
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for suggetions..,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Veeranjaneyulu.P ,
there are certain special characters that are not supported by UTF 8 encoding . For ex: foreign language characters
for this you can follow this link
http://www.dpawson.co.uk/xsl/characters.html
so i suggest you to use ISO encoding in place of UTF 8 encoding
In your receiver communication channel under text XML payload manipulation there is a field XML code , there you can define the coding you want fro example UTF 8 or ISO encoding
here if you will give ISO encoding in this field of receiver channel. then your output file may contain special characters such as foreign characters also
Hope this may solve your problem
Thanks
sandeep
PS : if helpful kindly reward points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what about this:
String win1251String = "STRING IN_WINDOWS-1251";
String utf8String= new String(win1251String.getBytes(windows-1251),utf-8);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no support for this in PI.
I think the best way is writing a Java Mapping.
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i suppose there are special converting java functions where you can convert entire string to utf-8 and from utf-8.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.