cancel
Showing results for 
Search instead for 
Did you mean: 

need generic function to substitute german umlaute (u00FC,u00E4,u00F6)

Former Member
0 Kudos

Hi,

do you know a genric funtion (udf or xslt or javacode) to substitute german umlaute ?

We have a lot of fields in the interface and wan´t to avoid to adopt a single function to each single fields.

Furthermore we don´t know which field could be filled with a german umlaute (every char field)

I tried to change the encoding from UTF-8(i.e. "Lübeck") to ISO 8859-1(i.e. result = "Lübeck") but without success.

Is there a generic function or other way to get this solved ?

Thanks,

Gordon

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

You can do it similar to this:

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]

Instead of &, you check for the different umlauts.

Can you tell me, why you want to replace the characters?

Former Member
0 Kudos

Hi Stefan,

thanks for the information.

We are sending IDoc-xml files with the JMS (MQ) to an external partner.

Example: Lübeck

In case we are using encoding = UTF-8 the IDoc and mapped xml file is filled with "Lübeck" but the partner need the "L(utf-8 code for ü)beck" or converted like "Luebeck".

The external partner send the message to another partner and there is an error like "L?',.beck"

any ideas ?

stefan_grube
Active Contributor
0 Kudos

This is a codepage issue.

When you use websphere MQ, apply the correct ccsid for UTF-8 (google or wikipedia can help)

The partner also has to work with the correct codepage when he forwards the message.

In my opinion it does not make sense to change ü to ue.

Former Member
0 Kudos

Thanks Stefan,

do I have to add the parameter in the JMS receiver cc ?

do you have the parametername ?

I cant find a parameternamer at MQ website.

stefan_grube
Active Contributor
0 Kudos

Are you talking about websphere?

http://www-01.ibm.com/software/globalization/ccsid/ccsid_registered.jsp

The parameter is called CCSID

1209 stands for UTF-8

Former Member
0 Kudos

"A JMS error occurred while processing message: xxxxx. The JMS provider gave the error mesage as MQJMS1046: The character set Cp1209 is not supported Cp1209, and the error code as MQJMS1046."

Can I use 1208 ?

edit:

I checked the Websphere monitor and saw that we are allready using ccsid 1208 for the message.

The monitor shows the xml message with umlaute "Lübeck".

Is that correct ? Maybe the partner has to change something ?

Edited by: Gordon Breuer on Aug 5, 2010 2:28 PM

Edited by: Gordon Breuer on Aug 5, 2010 2:28 PM

stefan_grube
Active Contributor
0 Kudos

I assume that your partner does not treat the message as UTF-8.

So your partner has to solve it.

Former Member
0 Kudos

OK. I will check this with our partner but ...

... is the value "Lübeck" correct by showing in the websphere moni(this is not our partner this is stillour systemlandscape) ?

stefan_grube
Active Contributor
0 Kudos

... is the value "Lübeck" correct by showing in the websphere moni

I don't get it. This is the value you expect, so why you ask?

stefan_grube
Active Contributor
0 Kudos

You can also use a hex editor and compare the value with a UTF-8 code table.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Even i faced a similar problem.

You have to create an XSLT mapping and import it in the imported archives:

XSLT mapping code will be :

<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>

Now in the interface mapping you need to use this xslt mapping first followed by the original graphical mapping.

Hope this helps

Regards,

Sainath Chutke

Former Member
0 Kudos

HI,

i tried this xslt ISO code change yesterday but without success.

I will get in contact with the partner to get this solved.

Thanks.

stefan_grube
Active Contributor
0 Kudos

When you change the encoding in the XML (you can use XMLAnonymizerBean for this also) then you have to apply a different CCSID related to the new encoding.

Before you start an integration scenario with a partner you have to negociate the encoding as part of the interface specification also. If you miss this part, you waste a lot of your time with try and error.

Former Member
0 Kudos

@Stefan:

I tried the java-mapping way(http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 ) as a nice learning session but i found some strange issues.


int read_data;

if (read_data != '&') 
...

this is not working because read_data has integer values instead of string values ?

I can´t check if there is an 'ü' (umlaut).

I checked the integervalue for "ü" = 195 but the value is used for other char´s, too (i.e for ä and é)

do you now a good way to check if there is a special char like "ä" or "ü" ?

Thanks,

Gordon

stefan_grube
Active Contributor
0 Kudos

good findings.

You have to use chars instead of integer.

ü is represented by two bytes.

Have you figured out which codepage is expected by the partner?

Or did the partner request the change of ü to ue?

Former Member
0 Kudos

Hi Stefan,

we fixed that problem by changing the codepage at partnerside.

I use this tutorial to get some more experience with java mappings.

"use char instead of integer" ... do you have an example ?

Thanks,

Gordon

stefan_grube
Active Contributor
0 Kudos

Another approach is using the method replaceAll of String

Like this:

byte[] bbuf = new byte[in.available()];

int bblen = in.read(bbuf);

String inputConverted = new String(bbuf,"UTF-8");

inputConverted = inputConverted.replaceAll("ü","ue");

inputConverted = inputConverted.replaceAll("ä","ae");

and so on.

stefan_grube
Active Contributor
0 Kudos

I checked the integervalue for "ü" = 195 but the value is used for other char´s, too (i.e for ä and é)

Whenever you find 195 in your byte stream, you check the next character also, as 195 marks a two byte character.

So you replace the two bytes of the ü,ä,ö with the two single byte characters ue, ae,oe

if (read_data != 195)

out.write(read_data);

else {

read_data = in.read()

switch read_data ...

http://www.utf8-chartable.de/unicode-utf8-table.pl

Edited by: Stefan Grube on Aug 11, 2010 10:40 AM

Former Member
0 Kudos

hi,

what do you mean by http://in.availale() ?


byte[] bbuf = new bytehttp://in.available();

stefan_grube
Active Contributor
0 Kudos

SDN displays it wrong, but I am sure you will figure out what you have to write.

Former Member
0 Kudos

if this is in a UDF, i think standard function replace shud also work. let me know if you try...

Former Member
0 Kudos

@Stefan: Great Job .. the replaceAll method is working perfect!

Is it possible to get the length of each field (in the inputstream) ?

For example: Inputstream interface = IDoc (field MANDT = length 3)

Is it possible to get the lnterfacestructure of the fields used in the mapping or do i have to read the XSD in my java mapping ?