cancel
Showing results for 
Search instead for 
Did you mean: 

Java mapping causing error - Unsupported character: u00A3

che_eky
Active Contributor
0 Kudos

Hi,

I have a JAVA SAX mapping which is giving the following error for files containing characters of type £ :

");

Perhaps the above will override the File Encoding parameter set in the Sender File Adapter?

Any other ideas?

Che

Edited by: Che Eky on Mar 31, 2009 12:50 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I guess UTF-8 does not support "£" - but ISO-8859-1 or ISO-8859-2 will do.

Pls check the message types in IR and the encoding that's given there.

Regards,

Kai

prateek
Active Contributor
0 Kudos

This would be of your interest

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

Regards,

Prateek

che_eky
Active Contributor
0 Kudos

Prateek,

The blog you mention handles special characters in XML like &, <, > and ' but the £ symbol is not a special character in XML.

Che

che_eky
Active Contributor
0 Kudos

Ok I can solve the problem by making the following change in the JAVA mapping:

public void startDocument() throws SAXException {

// Build and output XML header

// write("<?xml version=\"1.0\" encoding=
"utf-8\"?>");

write("<?xml version=\"1.0\" encoding=\"windows-1252\"?>");

write(lineEnd);

}

As this JAVA mapping is used in many places does anyone know how the mapping can be rewritten to determine the required encoding format (based on the communication channel)????????

Che

Shabarish_Nair
Active Contributor
0 Kudos

>

> As this JAVA mapping is used in many places does anyone know how the mapping can be rewritten to determine the required encoding format (based on the communication channel)????????

>

> Che

if you meant you want to know in the mapping what is the encoding used in the file sender adapter, then you can easily determine this by using ASMA and dynamic configuration

in your case it will be FileEncoding

See http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm -> Adapter-Specific Message Attributes

Also ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name for sample codes ...

Former Member
0 Kudos

Hi,

just for my understanding I wanted to know:

1) What encoding does the incoming XMl has? UTF-8?

2) Is the £ displayed correctly in the incoming message?

3) What encoding have you defined for you incoming / outgoing message types (XSDs / DTDs)

Thanks,

Kai

Shabarish_Nair
Active Contributor
0 Kudos

to use ASMA in Java mapping this will your reference;

http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/content.htm

ex.

DynamicConfigurationKey key = DynamicConfigurationKey.create(
    u201Chttp://sap.com/xi/XI/System/Fileu201D,
    u201CFileEncodingu201D);

String myEncoding = conf.get(key);

myEncoding will now have the encoding set in the file adapter

che_eky
Active Contributor
0 Kudos

Hi Kai,

1) What encoding does the incoming XMl has? UTF-8?

It has UTF-8 at the top of the xml file

2) Is the £ displayed correctly in the incoming message?

It has # when the file is uploaded using mode ASC for ACSII

It has £ when the file is uploaded using mode BIN for binary

3) What encoding have you defined for you incoming / outgoing message types (XSDs / DTDs)

In the Sender File Adapter I am using windows-1252

Che

Former Member
0 Kudos

Okay - thanks.

I wonder if this config would work:

1) Uploaded XML has ISO-8859-1 encoding in header.

2) XSD / DTD for message types in repository (used in the mapping - in & out) are set to produce XML with ISO encoding.

Is it possible to get rid of the JAVA part then? Not really sure, but came to my mind..

Regards,

Kai

stefan_grube
Active Contributor
0 Kudos

2) Is the £ displayed correctly in the incoming message?

It has # when the file is uploaded using mode ASC for ACSII

It has £ when the file is uploaded using mode BIN for binar

In the sender file adapter channel, the file type binary must be used for any XML file. Do not put any encoding to the channel, as the file might be corrupted.

The encoding of XSD or WSDL does not influence the encoding of the content, so you need not care about this.

Regards

Stefan