on 05-14-2008 11:20 AM
Hi.
I'm sending an XML file to an FTP-server.
In the adapter I have set Filetype to TEXT,
and File Encoding to ISO-8859-1.
The file contain som spesial characters, Æ, Ø Å etc.
Got an error when I try to open it with ex. IE.
When I look at the file on the FTP-server the encoding in the XML-header looks like this.: <?xml version="1.0" encoding="UTF-8" ?> .
I would like it to look like this.: <?xml version="1.0" encoding="ISO-8859-1" ?>
Can someone help me with this problem ?
Thanks
Check this blog:
/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
Set file type to binary, when you work with the XMLAnonymizerBean.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Stefan.
Your tip below solved my problem.
Set file type to binary, when you work with the XMLAnonymizerBean
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Follow this link
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried Transfer Mode to TEXT, but it dis'nt help.
I found a SAP-note 880173 which described how to use the Anonymizer Module i the file adapter but i'm not sure how to set the parameters.
Can someone tell me if I'm on the wrong track?
XSLT Mapping can't I use because I cant create the XSL-file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Here is the solution:
In FTP connection Parameter please Change the Transfer Mode to TEXT.
Thanks,
Boopathi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the following XSLT Mapping to change the codepage of an XML document.
from utf-8 to encoding ISO-8859-1.
***************************************
Change it to the required encoding of the target XML.
<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>
Also You can use the following Java mapping to change the codepage of a text document.
package com.sap.encoding.example;
import java.io.*;
import java.util.*;
import com.sap.aii.mapping.api.*;
public class UTFISO implements StreamTransformation {
private final String latin = "ISO-8859-1";
private final String utf ="UTF-8";
public void execute(InputStream in, OutputStream out) {
try {
DataInputStream stdin = new DataInputStream(in);
int length = getLengthFromStream(stdin);
stdin.reset();
byte[] buffer = getBytesFromStream(stdin);
String str = new String(buffer, utf);
str = str.replaceAll(utf, latin);
out.write(str.getBytes(latin));
out.close();
} catch (IOException e) {
}
}
public int getLengthFromStream(InputStream is ) throws
IOException{
int i = 0;
int length = 0;
try{
while ((i = is.read())> 0){
length ++;
}
}catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
}
return length;
}
public byte[] getBytesFromStream(InputStream is) throws
IOException {
// Create the byte array to hold the data
byte[] bytes = new byte[getLengthFromStream(is)];
is.reset();
// Read in the bytes
int offset = 0;
int tmp = 0;
while (offset < bytes.length
&& (is.read(bytes, offset, offset +
(tmp = is.available()))) > 0) {
offset += tmp;
}
// Ensure all the bytes have been read in
if (offset < bytes.length) {
throw new IOException("Could not
completely read Inputstream");
}
// Close the input stream and return bytes
is.close();
return bytes;
}
public void setParameter(Map param) {
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.