Iso-8859-1 to UTF-8

JExpert,
The encoding of my current servlet is iso-8859-1 when i execute the following method. How can I change it into UTF-8?
     public void displaySkinFile(HttpServletRequest req, HttpServletResponse resp, String skinFile) throws ServletException, IOException {
          try {
               String fileContent = getFileContent(skinFile);
               resp.setContentType("text/html");
System.out.println("encoding="+resp.getCharacterEncoding());
               PrintWriter out = resp.getWriter();
               out.println(fileContent);
          } catch (FileNotFoundException e) {
               logAndRedirect(req, resp, skinFile);
          } catch (IOException e) {               
               logAndRedirect(req,resp,skinFile);
Thanks!!

I am having a similar problem, but whenever I do the setContentType, it is not actually switching it for me. Any ideas?
CODE:
     protected void doGet(HttpServletRequest req, HttpServletResponse resp)
               throws ServletException, IOException {
          PrintWriter w = resp.getWriter();
          String text;
          String path = null;
          text = map.getDocumentText(path);
               System.out.println("BEFORE: Char Encoding");
               System.out.println(resp.getCharacterEncoding());
               System.out.println("BEFORE: Content Type");
               System.out.println(resp.getContentType());
          resp.setContentType("text/html; charset=utf-8");
          resp.setCharacterEncoding("UTF-8");
          resp.setContentLength(text.length());
          w.write(text);
               System.out.println("AFTER: Char Encoding");
               System.out.println(resp.getCharacterEncoding());
               System.out.println("AFTER: Content Type");
               System.out.println(resp.getContentType());
CONSOLE OUTPUT:
BEFORE: Char Encoding
ISO-8859-1
BEFORE: Content Type
null
AFTER: Char Encoding
ISO-8859-1
AFTER: Content Type
text/html;charset=ISO-8859-1

Similar Messages

  • Cannot change charset from 'ISO-8859-1' to 'UTF-8' ?

    I've programed a web application with Facelets. As I start the first page "index.html" I got the following exception:
    "java.lang.IllegalStateException: Attempt to change ContentType after calling getWriter() (cannot change charset from 'ISO-8859-1' to 'UTF-8')"
    The header of the "index.html" looks as follow:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="refresh" content="0; url=./guess.jsf" />
    <title>Untitled Document</title>
    </head>
    What's wrong? Is it a bug of weblogic?

    same problem here with wl8.1
    have you sold it and if yes, how?
    thanks

  • Convert from ISO 8859-1 encoding to UTF-8

    Hi
    My Os name is 'SunOS ut51109 5.10 Generic_144500-19 sun4v sparc SUNW,T5440'.
    I want to change the encoding of the existing .bcp file from ISO 8859-1 to UTF-8 with out using any temp files as these .bcp file will be pointed by an external table.
    here is the command I issued in the script(ksh file)
    iconv -f ISO8859-1 -t UTF-8 file1.bcp > file1.bcp
    After the script got executed file1 is empty(showing 0 bytes).
    Please correct me or let me know the syntax to be followed to write the data into the same file in UTF-8 format.
    Thanks
    kartheek

    You cannot do conversion from ISO 8859-1 to UTF-8 in-place because the UTF-8 version will generally be longer (unless you convert a pure ASCII file, which does not need conversion in the first place). Therefore, you would have to overwrite what you have not read yet. Instead, convert to a new file with a temporary name, drop the original and rename the temporary back to original. This is not that complicated.
    If the problem is that you want to overwrite a file already open by the database, then rename the incoming file first and then convert copying to the target.
    -- Sergiusz

  • British Pound Sterling with UTF-8 and ISO-8859-15

    Please excuse my long-windedness ... I'm simply trying to answer all possible questions up front and give the most possible information. I've searched through tons of forums and all over various sites and references and am not able to come up with a concrete solution to this. I'd appreciate any help anyone has.
    I'm having some trouble with character sets and international currencies.
    Our server was recently upgraded from Red Hat 7.3 to Red Hat 8.0. I understand that the default system encoding thus changed from ISO-8859-15 to UTF-8. I have verified this by executing the following:
    public class WhichEncoding {
      public static void main(String args[])
        String p = System.getProperty("file.encoding");
        System.out.println(p);
    }I have two machines, one which represents the old system (7.3) and one representing the new (8.0), which I will call machine73 and machine80 respectively.
    [machine73:~]# java WhichEncoding
    ISO-8859-15
    [machine80:~]# java WhichEncoding
    UTF-8I have also verified that the JVM is using the correct default character set by executing the following:
    import java.io.ByteArrayOutputStream;
    import java.io.OutputStreamWriter;
    public class WhichCharset {
        public static void main (String[] args) {
            String foo = (String)(new OutputStreamWriter(new ByteArrayOutputStream())).getEncoding();
            System.out.println(foo);
    }which yields:
    [machine73:~]# java WhichCharset
    ISO-8859-15
    [machine80:~]# java WhichCharset
    UTF8Here comes the problem. I have the following piece of code:
    import java.text.NumberFormat;
    import java.util.Locale;
    public class TestPoundSterling
        public static void main (String[] args)
            NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("en", "GB"));
            System.out.println(nf.format(1.23));
    }When I compile and execute this, I see mixed results. On machine73, I see what I would expect to see, the British Pound Sterling followed by 1.23. To be sure, I outputted the results to a file which I viewed in a hex editor, and observed [A3 31 2E 32 33 0A], which seems to be correct.
    However, when I execute it on machine80, I see a capital A with a circumflex (carat) preceding the British Pound Sterling and the 1.23. The hex editor shows [C2 A3 31 2E 32 33 0A].
    I looked up these hexadecimal values:
    Extended ASCII
    0xC2 = "T symbol"
    0xA3 = lowercase "u" with grave
    ISO-8859-1
    0xC2 = Capital "A" with circumflex (carat)
    0xA3 = British Pound Sterling
    Unicode Latin-1
    0x00C2 = Capital "A" with circumflex (carat)
    0x00A3 = British Pound Sterling
    (This explains why, when I remove /bin/unicode_start and reboot, I see a "T symbol" and "u" with a grave in place of what I saw before ... probably an irrelevant sidenote).
    I found a possible answer on http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 under the Examples section. Apparently, a conversion between Unicode and UTF-8 acts differently based on the original Unicode value. Since the Pound Sterling falls between U-00000080 � U-000007FF (using the chart on the mentioned site), the conversion would be (as far as I can tell):
    U-000000A3 = 11000010 10101001 = 0xC2 0xA3
    This appears to be where the extra 0xC2 pops up.
    Finally, to the whole point of this: How can I fix this so that things work as they should on machine80 like they did on machine73. All I want to see at the command line is the Pound Sterling. Getting the 0xC2 preceding the Pound Sterling causes some parts of my applications to fail.
    Here's some additional information that might be of use:
    [machine73:~]# cat /etc/sysconfig/i18n
    LANG="en_US.iso885915"
    SUPPORTED="en_US.iso885915:en_US:en"
    SYSFONT="lat0-sun16"
    SYSFONTACM="iso15"
    [machine73:~]# echo $LANG
    en_US.iso885915
    [machine80:~]# cat /etc/sysconfig/i18n
    LANG="en_US.UTF-8"
    SUPPORTED="en_US.UTF-8:en_US:en"
    SYSFONT="latarcyrheb-sun16"
    [machine80:~]# echo $LANG
    en_US.UTF-8Any help is very, very much appreciated. Thanks.

    you didn't look hard enough, this is a faq...
    there three options:
    1) change the system encoding by setting LANG or LC_CTYPE environment variables... assuming you use bash:bash$ export LC_CTYPE=en_GB.iso88591 you can check the available locales with locale -a ... pipe it to grep en_GB to filter out the non-british english locales
    -OR-
    2) change the java default encoding from the command line with -Dfile.encoding... run with$ java -Dfile.encoding=ISO-8859-1 yourclass-OR-
    3) set the encoding from within the program with OutputStreamWriter, or use a PrintStream that has the encoding set..PrintStream out = new PrintStream(new FileOutputStream(FileDescriptor.out), true, "ISO-8859-1");
    System.setOut(out);see also the internationalization tutorial & the javadoc of the related classes....

  • Conversion  ISO-8859-7- UTF-8  and UTF-8 - ISO-8859-7

    Hi, I written this function to do a Charset conversion
    from ISO-8859-7 to UTF-8 and vice versa
    void ChangeChersetEncoding(String EncodingType)
    String GrammarText;
    try
    GrammarText = Editor.getText();
    b = GrammarText.getBytes(LastEncoding);
    String strTemp = new String(b,EncodingType);
    Editor.setText(strTemp);
    LastEncoding = EncodingType;
    catch (UnsupportedEncodingException e)
    JOptionPane.showMessageDialog(this, "Error: " + e.getMessage
    () , "Error", JOptionPane.ERROR_MESSAGE);
    The steps followed are:
    1)I initialize Editor (that is a JEditorPane) with a InputStreamReader, that use by default "CP1252"(window - latin1) charset encoding.
    2)When I call the function the first time with EncodingType = "ISO-8859-7" and LastEncoding = "CP1252"(window - latin1), Editor shows greek character as I aspected.
    3)When I call the function the second time with EncodingType = "UTF-8" and LastEncoding = "ISO-8859-7", Editor shows unknown character ('&#65533;') as I aspected.
    4)The problem is when I call the function the third time with EncodingType = "ISO-8859-7" and LastEncoding = "UTF-8" Editor don't show the original greek text, as I didn't aspect.
    Thank you for all.

    b = GrammarText.getBytes(LastEncoding);
    String strTemp = new String(b,EncodingType);Here you take a String (which is in Unicode) and convert it to bytes, using "LastEncoding". Next you take those bytes and convert them back to a String, assuming that they were encoded using "EncodingType". But they weren't, so at best this will do nothing and at worst it will produce garbage. It certainly won't do anything useful.
    As I said all Java strings are in Unicode. If you want to convert something from one encoding to another encoding, you can only convert an array of bytes to a String using the first encoding, then convert that back to bytes using the second encoding. Converting a String to a String just makes no sense.

  • How to set the Xml Encoding ISO-8859-1 to Transformer or DOMSource

    I have a xml string and it already contains an xml declaration with encoding="ISO-8859-1". (In my real product, since some of the element/attribute value contains a Spanish character, I need to use this encoding instead of UTF-8.) Also, in my program, I need to add more attributes or manipulate the xml string dynamically, so I create a DOM Document object for that. And, then, I use Transformer to convert this Document to a stream.
    My problme is: Firstly, once converted through the Transformer, the xml encoding changed to default UTF-8, Secondly, I wanted to check whether the DOM Document created with the xml string maintains the Xml Encoding of ISO-8859-1 or not. So, I called Document.getXmlEncoding(), but it is throwing a runtime error - unknown method.
    Is there any way I can maintain the original Xml Encoding of ISO-8859-1 when I use either the DOMSource or Transformer? I am using JDK1.5.0-12.
    Following is my sample program you can use.
    I would appreciate any help, because so far, I cannot find any answer to this using the JDK documentation at all.
    Thanks,
    Jin Kim
    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    public class XmlEncodingTest
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Transformer transformer = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Yes\" />\n")
                     .append("</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("initial xml = \n" + xmlStrBuf.toString());
            try
                //Test1: Use the transformer to ouput the xmlStrBuf.
                // This shows the xml encoding result from the transformer which will change to UTF-8
                tFactory = TransformerFactory.newInstance();
                transformer = tFactory.newTransformer();
                StreamSource ss = new StreamSource( new StringBufferInputStream( xmlStrBuf.toString()));
                System.out.println("Test1 result = ");
                transformer.transform( ss, new StreamResult(System.out));
                //Test2: Create a DOM document object for xmlStrBuf and manipulate it by adding an attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new StringBufferInputStream( xmlStrBuf.toString()));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document. the encoding becomes UTF-8
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(System.out);
                System.out.println("\n\nTest2 result = ");
                transformer.transform(source, result);
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
        public static void main( String arg[])
            XmlEncodingTest xmlTest = new XmlEncodingTest();
            xmlTest.performTest();
    }

    Thanks DrClap for your answer. With your information, I rewrote the sample program as in the following, and it works well now as I intended! About the UTF-8 and Spanish charaters, I think you are right. It looks like there can be many factors involved on this subject though - for example, the real character sets used to create an xml document, and the xml encoding information declared will matter. The special character I had a trouble was u00F3, and somehow, I found out that Sax Parser or even Document Builder parser does not like this character when encoding is set to "UTF-8" in the Xml document. My sample program below may not be a perfect example, but if you replaces ISO-8859-1 with UTF-8, and not setting the encoding property to the transfermer, you may notice that the special character in my example is broken in Test1 and Test2. In my sample, I decided to use ByteArrayInputStream instead of StringBufferInpuptStream because the documentation says StringBufferInputStream may have a problem with converting characters into bytes.
    Thanks again for your help!
    Jin Kim
    import java.io.*;
    import java.util.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    * XML encoding test for Transformer
    public class XmlEncodingTest2
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Resoluci�n\">\n")
                     .append("Special charatered attribute test")
                     .append("\n</ELEM>")
                     .append("\n</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("**** Initial xml = \n" + xmlStrBuf.toString());
            try
                //TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
                //Test1: Use the transformer to ouput the xmlStrBuf.
                tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();
                byte xmlbytes[] = xmlStrBuf.toString().getBytes("ISO-8859-1");
                StreamSource streamSource = new StreamSource( new ByteArrayInputStream( xmlbytes ));
                ByteArrayOutputStream xmlBaos = new ByteArrayOutputStream();
                Properties transProperties = transformer.getOutputProperties();
                transProperties.list( System.out); // prints out current transformer properties
                System.out.println("**** setting the transformer's encoding property to ISO-8859-1.");
                transformer.setOutputProperty("encoding", "ISO-8859-1");
                transformer.transform( streamSource, new StreamResult( xmlBaos));
                System.out.println("**** Test1 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //Test2: Create a DOM document object for xmlStrBuf to add a new attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new ByteArrayInputStream( xmlbytes));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document.
                DOMSource source = new DOMSource(document);
                xmlBaos.reset();
                transformer.transform( source, new StreamResult( xmlBaos));
                System.out.println("\n\n****Test2 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //xmlBaos.flush();
                //xmlBaos.close();
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
            finally
        public static void main( String arg[])
            XmlEncodingTest2 xmlTest = new XmlEncodingTest2();
            xmlTest.performTest();
    }

  • Como deixar a codificação padrão "iso-8859-1" ao invés de "utf-8" no navegador?

    Quando faço o acesso ao banco do meu cartão de crédito, a primeira pagina deles é codificada com "UTF-8" e também existe o comando "charset=utf-8" no código HTML, após digitar o número do cartão, ele direciona para outra página, porém codificada com "iso-8859-1", mas sem nenhuma codificação no código HTML.
    Identifiquei que o navegador usa por padrão o "utf-8" quando não existe codificação no código HTML, então gostaria de modificar esse padrão para "iso-8859-1".
    O único lugar que encontrei para essa codificação foi ao pressionar o botão de avançado em "Fontes e cores", porém não funcionou.
    A versão do meu navegado é 23.0.1, entretanto desde a versão 18 que encontro esse problema.

    It is possible that the server sends the file(s) by default with UTF-8 and in such a case this encoding send by the server prevails over all other settings.
    You can see the encoding here: Tools > Page Info > General
    *Press the F10 key or tap the Alt key to bring up the hidden "Menu Bar" temporarily.

  • UTF-8 encoding vs ISO 8859-1 encoding

    The iTunes tech specs call for UTF-8 encoding of the XML feed file; a friend of mine uses feed generator software through his blog that uses ISO 8859 encoding. Is there a way to convert the latter to UTF-8 so that iTunes tags may be successfully added?
    When I tried editing his XML file, I got error messages when I submitted the file to RSS feed validator sites (such as http://feedvalidator.org/. Any help or knowledge is appreciated because I am not the least bit expert in this coding arena.

    You don't need to convert iso 8859-1 (us-ascii) to utf-8 unless you have nonstandard characters. Basically, ascii is a subset of utf-8 and for English it will serve you just fine. You can have iTunes tags in the xml file even if the file itself is encoded in iso 8859-1.
    The error you see at feedvalidator.org is most likely a warning.
    Hope this helps!
    - Andy Kim
    Potion Factory
    http://www.potionfactory.com

  • Codepage coverting error utf-8 from System codepage to iso-8859-1 (PI 7.1)

    Hello Experts,
    In our Prcess, we receive an Idoc from an IS-U system and then we send this Idoc with some Header-Information via http-Adapter to a Seeburger System.
    In the outbound communication Channel we have a XI Payload manipulation with xml-Code iso-8859-1.
    We get the Error: Codepage coverting error utf-8 from System codepage to iso-8859-1, and only for this Idoc, where othe similar Idocs runs correctly.
    Is it possible, that the Idoc contains non-utf-8 chars so the error occurs?
    PS: another XI in our landscape uses a http-Channel with the same configuration in a similar process, an it work, so guess the Problem is not in the communication channel.
    thanks,
    best regards

    > Is it possible, that the Idoc contains non-utf-8 chars so the error occurs?
    A would rather think, that there could be any non-iso-8859-1 character be in the IDoc. For example an czech or polish character.

  • HTTP adapter - change encoding from UTF-8 to ISO-8859-1

    Hi,
    I am trying to change the encoding used by the HTTP sender adapter in a scenario.
    However, when I enter ISO-8859-1 in the XML Code under XI Payload Manipulation on the comms channel it has no effect - the paylad still shows as UTF-8 in SXI_MONITOR.
    Am I missing a step or entering the field incorrectly ??
    Thanks
    Colin.

    Hi,
    From help
    Enhancing the Payload
    Some external systems, for example, Web servers in marketplaces, can only process data if it is sent as an HTML form using HTTP.
    A typical HTML form comprises named fields. When transferring a completed form to the server or a CGI program, the data must be transferred in such a way that the CGI script can recognize the fields that make up the form, and which data was entered in which field.
    The plain HTTP adapter constructs this format using a prolog and an epilog. Therefore, there is a particular code method that separates form fields and their data from each other. This code method uses the following rules:
         Individual form elements, including their data, are separated from each other by the character &.
         The name and data of a form element are separated from each other by an equals sign (=).
         Blanks in the entered data (for example, in multiple words) are replaced by a plus sign (+).
        All characters with the (enhanced) ASCII values 128 to 255 (hexadecimal 80 to FF) are transcribed using a hexadecimal sequence, beginning with a percentage sign (%) followed by the hexadecimal value of the character (for example, the German umlaut ö in the character set ISO-8859-1 is transcribed as %F6).
       All characters that occur in these rules as control characters (&, +, =, and %) are also transcribed hexadecimally in the same way as high value ASCII characters
    http://help.sap.com/saphelp_nw2004s/helpdata/en/44/79973cc73af456e10000000a114084/content.htm
    Regards
    Chilla

  • Convert utf-8 to iso-8859-1

    Hello,
    sorry for my very bad english
    i use httpxmlrequest to answer a database and show resultin a
    div
    the string means utf-8 encoded by my javascript fonction and,
    of course,
    no result are found in the database.
    How can i convert the string to iso-8859-1 before request the
    database ?
    Thank if you have an idea
    JiBé (France)

    PaulH **AdobeCommunityExpert** a écrit :
    > Jibé wrote:
    >> PaulH **AdobeCommunityExpert** a écrit :
    >> I work with a MS SQL server database encoding in
    iso-8859-1
    >
    > data stored in plain text,char,varchar datatypes (ie not
    "N")?
    datatype of "titre" is varchar(250) and "contenu" is text
    using the
    > ODBC or JDBC (it would be listed as ms sql server in the
    db drivers
    > list) driver?
    I think it's jdbc driver (case of my test computer)
    >
    >> The code :
    >
    > you're not following good i18n practices. while my
    preference is for
    > unicode ("just use unicode" has been my motto for
    years), if you're
    > really only ever going to use french & never need
    the euro symbol then i
    > guess iso-8859-1 (latin-1) is fine.
    Here is a part of the content of my application.cfm
    <cfprocessingdirective pageencoding="iso-8859-1">
    <cfcontent type="text/html; charset=iso-8859-1">
    <cfset setEncoding("URL", "iso-8859-1")>
    <cfset setEncoding("Form", "iso-8859-1")>
    >
    > if you think you might need other languages, including
    the euro symbol,
    > then you should consider unicode. change your text
    columsn to "N" type
    > (nText, nChar, nVarChar) & swap the latin-1
    encodings in the tags above
    > to utf-8.
    I'm going to test that....
    JiBé

  • XML Encoding Issue - Format UTF-16 to ISO-8859-1

    Dear Groupmates,
    I have data in my Internal table which i am converting to XML using custom Transformation.
    Data is going to third party.The third party system requires data in ISO-8859-1 Format but SAP is generating the same in UTF-16 Format.I have been able to change the format of file from
    utf-16 to ISO-8859-1 format but after conversion i am getting invalid tag information in form of characters
    like &lt , &gt etc..in my file.
    Here is the code i have used to set the encoding to ISO-8859-1 :-
    DATA: xmlout TYPE xstring.
    DATA: ixml TYPE REF TO if_ixml,
    streamfactory TYPE REF TO if_ixml_stream_factory,
    encoding TYPE REF TO if_ixml_encoding,
    ixml_ostream TYPE REF TO if_ixml_ostream.
    ixml = cl_ixml=>create( ).
    streamfactory = ixml->create_stream_factory( ).
    ixml_ostream = streamfactory->create_ostream_xstring( xmlout ).
    encoding = ixml->create_encoding(
    character_set = 'ISO-8859-1' byte_order = 0 ).
    ixml_ostream->set_encoding( encoding = encoding ).
    Sample Output :-
    <?xml version="1.0" encoding="iso-8859-1"?>
    <AMS_DOC_XML_EXPORT_FILE><AMS_DOCUMENT AUTO_DOC_NUM="FALSE" DOC_CAT="CA" DOC_CD="CA" DOC_DEPT_CD="045" DOC_ID="XR10281060830400001" DOC_IMPORT_MODE="OE" DOC_TYP="CH" DOC_UNIT_CD ="NULL" DOC_VERS_NO="01">
    <CH_DOC_HDR AMSDataObject="Y">
    <DOC_CAT Attribute="Y">&lt;![CDATA[CA]]&gt;</DOC_CAT>
    <DOC_TYP Attribute="Y">&lt;![CDATA[CH]]&gt;</DOC_TYP>
    Please let me know if anyone has idea how i can get rid of the invalid tag information.
    Thanks !
    With Regards,
    Darshan Mulmule

    Darshan,
    Did you get an answer for this question? We have same requirement to create XML file in ISO-8859-1 format with Attributes is set to "Y" and CDATA is being used for data.
    Can you please let me know if you still remember how did you achieve it?
    Satyen...

  • Convert UTF-8 to ISO-8859-1 in JMS receiver

    Hi Freinds,
    We are sending an XML message to the MQ via JMS receiver channel and I need to change the character set from UTF-8 to the ISO-8859-1 while sending it to the MQ queues. Will this be possile?
    Please suggest how can I acheive this.
    Regards,
    Kumar.

    Hi Kumar,
    Try changing the encoding using XSLT mapping and you can call this mapping as shown in this blog:
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    or try this wiki page:
    http://wiki.sdn.sap.com/wiki/display/XI/SOAPMessagesin+XI
    Regards
    Suraj

  • Convert XML-String from Codepage utf-16 to ISO-8859-1

    Hi to all experts,
    our system is now unicode with codepage 4102 (UTF-16) and we do an Simple Transformation for creating an XML-String.
    before UniCode : xml_data = <?xml version="1.0" encoding="iso-8859-1"?>#<transactionRequest userID=" .......
    now with UniCode : xml_data = <?xml version="1.0" encoding="utf-16"?>#<transactionRequest userID=".......
    The xml_data transfered to an external Sytem via HTTPS- Communication direct from ABAP.
    The external Sytem send an Error Request:
    <?xml version="1.0" encoding="ISO-8859-1"?>#<transactionResponse>#    <transactionErrorResponse>#        <errorResponse>#            <errorCode>SYS-0001</errorCode>#            <errorDescription>java.lang.Exception: null[ #<?xml version="1.................
    Have you any idea
    Thanks for your help!
    Peter
    Edited by: Peter Pforr on Sep 25, 2008 9:59 AM
    Edited by: Peter Pforr on Sep 25, 2008 10:14 AM

    Darshan,
    Did you get an answer for this question? We have same requirement to create XML file in ISO-8859-1 format with Attributes is set to "Y" and CDATA is being used for data.
    Can you please let me know if you still remember how did you achieve it?
    Satyen...

  • JasperReports Integration PDF is created with ISO-8859-1 instead of UTF-8

    Hi,
    This is a strange problem i'm struggling with. Since about one month the PDF's are created with the wrong character set. Instead of UTF-8 (this is also given as a parameter calling the procedure as you see below) the PDF are always created with ISO-8859-1.
    declare
    l_jasper_report_url VARCHAR2(100) DEFAULT 'http://localhost:8180/JasperReportsIntegration/report';
    l_rep_name VARCHAR2(80) DEFAULT'SLRReports/SLR_Statistic_Service_Level_Report_Monat';
    l_rep_format VARCHAR2(10) DEFAULT 'pdf';
    l_data_source VARCHAR2(20) DEFAULT 'default';
    l_rep_locale VARCHAR2(10) DEFAULT 'de_CH';
    l_rep_encoding VARCHAR2(10) DEFAULT 'UTF-8';
    l_StartDate DATE;
    l_EndDate DATE;
    l_MinDowntime INTEGER DEFAULT 1;
    l_ServiceHour CHAR DEFAULT 'Y';
    l_name VARCHAR2(50);
    l_typ VARCHAR2(20) DEFAULT 'monatsreport_ccps';
    l_additional_params VARCHAR2(200);
    l_mime_type VARCHAR2(30);
    l_blob BLOB;
    BEGIN
    l_StartDate := to_date('01.'||to_char( add_months(SYSDATE,-12),'MM.YYYY'),'DD.MM.YYYY');
    l_EndDate := to_date('30.'||to_char( add_months(SYSDATE,-1),'MM.YYYY'),'DD.MM.YYYY');
    l_name := 'slr-statistik-'||to_char(l_StartDate,'YYYY-MM')||'.pdf';
    l_additional_params := 'UserName=SYSTEM'||chr(38)||'String_StartDate='||to_char(l_StartDate,'dd.mm.yyyy')||chr(38)||'String_EndDate='||to_char(l_EndDate,'dd.mm.yyyy')||chr(38)||'SLR_MinDowntime='||l_MinDowntime||chr(38)||'SLR_ServiceHour='||chr(38)||l_ServiceHour;
    xlog ('PRC_GET_REPORT_TUNNEL', 'url (orig):' || l_rep_name||':'||l_additional_params);
    -- generate the report and return in BLOB
    xlib_jasperreports.set_report_url (l_jasper_report_url);
    xlib_jasperreports.get_report (
    p_rep_name => l_rep_name,
    p_rep_format => l_rep_format,
    p_data_source => l_data_source,
    p_rep_locale => l_rep_locale,
    p_rep_encoding => l_rep_encoding,
    p_additional_params => l_additional_params,
    p_out_blob => l_blob,
    p_out_mime_type => l_mime_type );
    dbms_output.put_line('p_out_mime_type: '||l_mime_type);
    -- insert into report (id,name,typ,mime_type,lob_text,datum) values (p_report_seq.nextval,l_name,l_typ,l_mime_type,l_blob,sysdate);
    -- commit;
    -- apex_application.g_unrecoverable_error := TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    xlog ('PUT_BLB', SQLERRM, 'ERROR');
    RAISE;
    END;
    It looks like the procedure UTL_HTTP.get_header ignores the encoding parameter and overwrites it with ISO-8859-1. I also tried to set it with UTL_HTTP.set_header before calling UTL_HTTP.get_header buth that didn't help either.
    Then I started the JVM is started with the UTF-8 option and that made no change.
    There were no new installation on Oracle, tomcat or JasperReports side. So I'm wondering what has caused this string behaviour.
    Does anyone had this problem before or has a solution for it?
    I appreciate your help very much.
    Thanks and regards,
    Chris

    Hi,
    As my understanding, you could choose the encoding ways by yourself:
    Change your Internet Explorer 9 language
    encoding settings
    Alex Zhao
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Maybe you are looking for