on 04-08-2008 12:25 PM
Hi,
I have to convert an incoming Arabic string (Arabic letters) into the hex values in my message magging.
Can anybody help me with that UDF?
Thanks in advance
Dominic
Hi Dominic,
Do you want to parse all received arabic chars received in your payload to their corresponding byte value and storing them in a byte array or something similar ?
Do you want to do this in a graphical msg mapping with a UDF function ?
For UDF function, you will have to parse the corresponding input node (plugged in a a java string ?) to a byte sequence serialized in an output node (string), ie :
"blabla" -> "626C61626C61"
If you still need to find a solution, let me know, I may have something similar (I do not have access to my sources at the moment), for I had to do this once
Rgds
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you want to convert an arabic text string into hex, how should the hex string look like? How should the hex values be determined?
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your encoding standard in your message mapping is UTF-8 by default.
Hence you have to change to ISO-8859-5 encoding format which supports your Arabic characters.
Hence you should perform either XSLT mapping or Java mapping for conversion.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="ISO-8859-1"/>
<xsl:template match="/">
<xsl:copy-of select="*" />
</xsl:template>
</xsl:stylesheet>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gabriel,
thanks for you response.
My scenario is the following:
I'm getting a message via a Z-RFC from ERP system. Only one field is filled with Arabic letters. As we are adviced to use message mapping, I have to convert the arabic valu of that field to a hex value because it's a requirement by the receiver.
So my only possibility is to write an UDF wich converts the value.
For that I need support in the Java development for the UDF.
Thanks in advance
Dominic
if you want to replace all & to &.
Here is a sample code:
code public void execute (InputStream in, OutputStream out)
throws StreamTransformationException {
try {
int c;
while ((c = in.read()) != -1) {
if (c != '&') {
out.write(c);
} else {
// ampersand
out.write("&".getBytes());
}
} // while
out.flush();
} catch (Exception e) {
throw new StreamTransformationException(e.getMessage(),e);
}
}
Like wise you can change your arabic char set into corresponding UTF-8 char set.
Hi
out.write("&".getBytes());
for eg
if you want to print Proctor & gamble in target, it wont print due to escape sequence '&'.
for that you are going to convert & into 'and' in target structure by java mapping.
likewise
what are all the arabian char you receive try to convert into your native understandable one format.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.