Problems reading Latin2 (ISO 8859-2) characters

Hello!
I want to read the content of an MS Access table (in an MDB file) using the JDBC:ODBC driver.
The program works well but there is a character conversion problem when I read text fields from the table.
The Latin2 (ISO 8859-2) characters like áéíóőűüöÁÉÍÓÜÖŰŐ are replaced by the "?" character.
I use the ResultSet object's getString() method.
Any idea about how to solve this problem?

Try to change session encoding from defaut to iso-8559-2
This probably would help:
http://download.oracle.com/javase/1.4.2/docs/guide/jdbc/bridge.html
>
What's New with the JDBC-ODBC Bridge?
* A jdbc:odbc: connection can now have a charSet property, to specify a Character Encoding Scheme other than the client default.
For possible values, see the Internationalization specification on the Web Site.
The following code fragment shows how to set 'Big5' as the character set for all character data.
// Load the JDBC-ODBC bridge driver
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ;
// setup the properties
java.util.Properties prop = new java.util.Properties();
prop.put("charSet", "Big5");
prop.put("user", username);
prop.put("password", password);
// Connect to the database
con = DriverManager.getConnection(url, prop);

Similar Messages

  • Problem with charset  ISO-8859 with dinamic action

    Hello
    I migrated my application that was Apex 3.2, and now Apex is 4.2.3, but a have a problem when I'm use Dynamic Action with ISO-8859.
    When I used a filter "ação" in dinamic action filter mounted by the apex presents 'aà § à £ o.'
    If I force use of PlsqlNLSLanguage = BRAZILIAN PORTUGUESE_BRAZIL.UTF8 in Dads, works correct.
    Please, Help me! I need to keep ISO-8859!
    Thanks

    Using another example to illustrate the problem… I
    found an apparent solution using "encodeURI".
    It sees:
    quote:
    BEFORE:
    function SaveMsg()
    if (document.sender.message == "" )
    return false;
    var mensagem=document.sender.message.value;
    ds2.setURL('responsexml.asp?action=add'&msg='+mensagem);
    ds2.loadData();
    document.sender.message.value="";
    document.sender.message.focus();
    When the entrance of the changeable "mensagem" was
    “João” was recorded in archive XML as
    “Joo” ...
    input: "João"
    output: "Joo"
    quote:
    AFTER:
    function SaveMsg()
    if (document.sender.message == "" )
    return false;
    var mensagem=encodeURI(document.sender.message.value);
    ds2.setURL('responsexml.asp?action=add'&msg='+mensagem);
    ds2.loadData();
    document.sender.message.value="";
    document.sender.message.focus();
    Now ...
    input: "João"
    output: "João"
    This would be a good solution? I will not have problems,
    right? Some opinion/suggestion on this solution?

  • ISO-8859-1 characters in xmlDom.domDocument

    -- Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    -- JServer Release 8.1.7.0.0 - Production
    -- Oracle XML Parser 2.0.2.9.0 Production
    -- OS: Windows 2000 Professional
    -- NLS_LANG in Oracle is: AMERICAN_AMERICA.UTF8
    -- NLS_LANG in registry (client) is set to: SWEDISH_SWEDEN.WE8ISO8859P1
    -- Description: Getting corrupt characters instead of the
    -- Swedish characters "edv" after parsing the clob.
    -- Output after running this script in sqlplus:
    --| BEFORE
    --| -----------------------------------------------------------------------
    --| AFTER
    --| -----------------------------------------------------------------------
    --| <?xml version="1.0" encoding="ISO-8859-1"?><asdf>aaa edv aaa</asdf>
    --| <?xml version = '1.0' encoding = 'ISO-8859-1'?>
    --| <asdf>aaa ??? aaa</asdf>
    --|
    set serveroutput on
    drop table xmltest;
    create table xmltest
    (before clob
    ,after clob);
    declare
    beforeClob clob;
    afterClob clob;
    xdoc xmldom.domdocument;
    parser xmlparser.Parser;
    begin
    insert into xmltest
    values('<?xml version="1.0" encoding="ISO-8859-1"?><asdf>aaa edv aaa</asdf>', empty_clob())
    returning after into afterClob;
    select before
    into beforeClob
    from xmltest;
    parser := xmlparser.newParser;
    xmlparser.parseCLOB(parser,beforeClob);
    xdoc := xmlparser.getDocument(parser);
    xmlparser.freeParser(parser);
    dbms_output.put_line('Parsed xml charset: '||xmldom.getCharset(xdoc));
    xmldom.writeToClob(xdoc, afterClob, 'WE8ISO8859P1');
    commit;
    end;
    select * from xmltest;

    Hi,
    This is a known issue. Within CLOB, Oracle DB will always store data in UTF-8, so the encoding setups will not work.
    Thanks.

  • Polish (iso-8859-2) characters in JSP don't display properly...

    I created a test JSP file:
    <%@page contentType="text/html; charset=iso-8859-2"%>
    <html>
    <head>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
    </head>
    <body>
    2+2=<%= 2+2 %><br>
    <!-- this garbage are polish-specific characters -->
    ±æê³ñ󶼿
    ¡ÆÊ£ÑÓ¦¬¯
    <br>
    </body>
    </html>
    The problem is that one of polish-specific characters gets turned into
    a question mark (the character o-dashed, "ó" and (capitalized) "Ó").
    I searched the group archives but didn't found anything related to this
    problem.
    Lukasz Kowalczyk

    Try using ISO8859_2 in place of iso-8859-2 on the @page directive and the charset=. Also in the weblogic.properties file, in the WEBLOGIC JSP PROPERTIES section, add the following lines:
    verbose=true,\
    encoding=ISO8859_2
    It will work. I have done the same thing for SJIS just now.
    Keep me informed about it.
    Nikhil
    Lukasz Kowalczyk <[email protected]> wrote:
    I created a test JSP file:
    <%@page contentType="text/html; charset=iso-8859-2"%>
    <html>
    <head>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
    </head>
    <body>
    2+2=<%= 2+2 %><br>
    <!-- this garbage are polish-specific characters -->
    ±æê³ñ󶼿
    ¡ÆÊ£ÑÓ¦¬¯
    <br>
    </body>
    </html>
    The problem is that one of polish-specific characters gets turned into
    a question mark (the character o-dashed, "ó" and (capitalized) "Ó").
    I searched the group archives but didn't found anything related to this
    problem.
    Lukasz Kowalczyk

  • Problems with reading XML files with ISO-8859-1 encoding

    Hi!
    I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
    Here's the code:
    import java.io.File;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.net.*;
    * @author gustav
    public class RSSDocument {
        /** Creates a new instance of RSSDocument */
        public RSSDocument(String inurl) {
            String url = new String(inurl);
            try{
                DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = builder.parse(url);
                NodeList nodes = doc.getElementsByTagName("item");
                for (int i = 0; i < nodes.getLength(); i++) {
                    Element element = (Element) nodes.item(i);
                    NodeList title = element.getElementsByTagName("title");
                    Element line = (Element) title.item(0);
                    System.out.println("Title: " + getCharacterDataFromElement(line));
                    NodeList des = element.getElementsByTagName("description");
                    line = (Element) des.item(0);
                    System.out.println("Des: " + getCharacterDataFromElement(line));
            } catch (Exception e) {
                e.printStackTrace();
        public String getCharacterDataFromElement(Element e) {
            Node child = e.getFirstChild();
            if (child instanceof CharacterData) {
                CharacterData cd = (CharacterData) child;
                return cd.getData();
            return "?";
    }And here's the error message:
    org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
        at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
        at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
        at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
        at getrss.RSSDocument.<init>(RSSDocument.java:25)
        at getrss.Main.main(Main.java:25)

    I read files from the web, but there is a XML tag
    with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
    Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
    In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s).

  • HTTP-Receiver: Code page conversion error from UTF-8 to ISO-8859-1

    Hello experts,
    In one of our interfaces we are using the payload manipulation of the HTTP receiver channel to change the payload code page from UTF-8 to ISO-8859-1. And from time to time we are facing the following error:
    u201CCode page conversion error UTF-8 from system code page to code page ISO-8859-1u201D
    Iu2019m quite sure that this error occurs because of non-ISO-8859-1 characters in the processed message. And here comes my question:
    Is it possible to change the error behaviour of the code page converter, so that the error will be ignored?
    Perhaps the converter could replace the disruptive character with e.g. u201C#u201D?
    Thank you in advance.
    Best regards,
    Thomas

    Hello.
    I'm not 100% sure if this will help, but it's a good Reading material on the subject (:
    [How to Work with Character Encodings in Process Integration (NW7.0)|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42]
    The part of the XSLT / Java mapping might come in handy in your situation.
    you can check for problematic chars in the code.
    Good luck,
    Imanuel Rahamim.

  • Big5 to ISO-8859-1

    Hi, I want to convert a big5 chinese character to ISO-8859-1 character (&#xxxxx;)
    Here is my code:
    String record = "���~"; //a big5 string
    System.out.println("BIG5: " + record); //Display ok
    byte[] b = record.getBytes("ISO-8859-1");
    String target = new String(b, "ISO-8859-1");
    System.out.println("Target: " + target);
    But I can't get the ISO-8859-1 code which like &#xxxxx; but gives me ???.
    Please advice.

    ISO-8859-1 DO have chinese characters
    In JSP, when I submit a chinese value in a form, I "ll
    receive this chinese characters in ISO-8859-1
    encodings and get: &#22909;&#20154; (In chinese:
    �n�H)
    And when I put this ISO-8859-1 characters in the value
    field of a form, the html gives me chinese character
    in Big5 correctly.
    I just don't know how to convert ISO-8859-1 to Big5 in
    Java and vice versa.
    Please help.ISO-8859-1 doesn't support chinese characters.
    The reason that you can received chinese characters from a html form was because the charset of that html page was set to BIG-5. When a user makes a request, all request parameters and values will be encoded with the charset of the HTML page.

  • How to get ISO-8859 characters from DOM ?

    Hi,
    I have problems to get the ISO-8859 characters from the DOM. I parse a XML file and read the values from the DOM. All "umlauts" are scrambled.
    The details:
    The first line of the XML file is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    It contains lines like:
    <tag>Dpfel</tag>
    I perform the following steps:
    I'm parsing the XML file ...
    xmlparser.parse( parser, full_fname_xml );
    ... get the document ...
    doc := xmlparser.getDocument( parser );
    ... and read the value from the TEXT_NODE:
    nodevalue := xmlparser.getNodeValue( node );
    And here is the problem: nodevalue does
    not contain 'Dpfel' but '?pfel'.
    Its not a problem of the database. Explizit INSERTs with "umlauts" e.g. are working fine.
    This problem occurs with the XML Parser for PLSQL 1.0.0.1.0 on NT.
    [Pls do not recommend to use the newer version. I did a test with the newer version and know it works there.]
    My questions relates only to this older version:
    Will it never work with this version
    or what am I doing wrong ?
    Any hints welcome !
    Tnx
    Franz
    null

    Tnx for the quick answer.
    Sorry, indeed I can not use the newer
    version in the moment.
    So I urgently need a solution or any
    workaround for this version.
    F.

  • Java App on Linux : Unable to read iso-8859-1 encoded file correctly.

    I have a file which is encoded as iso-8859-1, and contains characters such as ô .
    I am reading this file with java code, something like:
    File in = new File("myfile.csv");
    InputStream fr = new FileInputStream(in);
    byte[] buffer = new byte[4096];
    while (true) {
    int byteCount = fr.read(buffer, 0, buffer.length);
    if (byteCount <= 0) {
    break;
    String s = new String(buffer, 0, byteCount,"ISO-8859-1");
    System.out.println(s);
    However the ô character is always garbled, usually printing as a ? .
    I am running this on a Linux machine. It works fine on my XP machine.
    I have verified that I can see the correct characters when I cat the file on the terminal.
    (Interestingly, but I think maybe only by co-incidence, it works when I run with the -Dfile.encoding=UTF16 option, but not with UTF8, although this appears a hack rather than a fix since this option was not intended for developer use by sun - but I thought mentioning it may provide some clues as to what is going on)

    I think your main probelm is with the console. When you send text to the console, it's sent in the system default encoding. On an English-locale system that might be ASCII, ISO-8859-1, windows-1252, UTF-8, MacRoman, and probably several other possibilities. Then the console decodes the the bytes using whatever encoding it feels like using--on my WinXP machine, it uses cp437 by default (just for laughs, as far as I can tell). If the text happens to be pure, seven-bit ASCII, there's no problem, since all those encodings are identical in that range.
    But if you need to output anything other than ASCII characters, avoid the console. Send the output to a file and specify an encoding that you know will be able to handle your characters--UTF-8 can handle anything. Then open the file with an editor that can read that encoding; most of them can handle UTF-8 these days, and many will even detect it automatically. You also need to be using a font that can display your characters.
    However, you're also going about the reading part wrong. Instead of reading the text in as bytes and passing them to a String constructor, you should use an InputStreamReader and read it as text from the beginning: BufferedReader br = new BufferedReader(
      new InputStreamReader(
        new FileInputStream("myfile.csv"), "ISO-8859-1"));I am curious about your statement that "it works" when you run with the -Dfile.encoding=UTF16 option. I wouldn't be surprised to see it output the correct characters (ASCII characters, anyway), but I would expect to see the characters interspersed with blank spaces or rectangles.

  • WIN-1252 characters in ISO-8859-1 textfields

    My questing concerns the following situation :
    The Apex-Dads is configured to be WE8ISO8859P1, the database has the same character set.
    When submitting a text-field in an APEX-page, a user can submit win1252 characters : chr:128-159, although the page encoding is
    ISO-8859-1.
    These characters are even displayed on the apex-page(in IE, FF on windows) as the represented win1252 character.
    However when these characters are inserted in the database, I have non-display characters.
    My question is, how can I prevent these characters from being entered in the database ?
    I've tried these
    * I can assume that all input arrives in Win1252 and convert all data in the database. (seems not the optimal solution)
    * I can configure the dad to be UTF8, so there will be a conversion from UTF-8-&gt; ISO-8859-1.
    However some characters aren't translated properly.
    Partly this is acceptable : chr128 (euro) isn't available in ISO-8859-1 but chr146 : right shifted quote is 'translated' to ¿ (inverted quotation mark).
    Perhaps someone had the same experience and can give me some more info or tips.
    Thanks in advance,
    Art
    Edited by: amels on Sep 19, 2008 1:11 PM

    Hello Art,
    >> Do you know why this is / should be ?
    This setting became mandatory in version 2.0, when the AJAX framework was introduced. Since then, the APEX environment itself is massively using this technology. Although the XMLHttpRequest object can support deferent character sets, its default setting is UTF-8. Using AL32UTF8 in the DAD simplify the “behind the scenes” AJAX support. This configuration also simplifies import/export of APEX applications and data, minimizing some client-server character set conversions, and I probably don’t know all the reasons that led to make this configuration a mandatory one.
    The important thing to remember is that it is a mandatory setting, and ignoring it will defiantly cause you problems in functionality, both in the development environment, and the run-time environment.
    Regards,
    Arie.

  • Encoding Characters ISO-8859-2

    You say:
    You need to set your $ORACLE_HOME environment variable point to the database of interest.
    I mean:
    We work under WinNT(SP4) with MS DevStudio 6.0. What can I do to encoding Character ?
    I put line <?xml version="1.0" encoding="ISO-8859-2"?> in the XML-Header, but the oracle-parser say ' LPX-00201 '.
    Help, I need somebody help ? Thanks Matthias

    I've found a solution. Yes, the problem was, when I've written polish characters into Excel file it encoded them as a rubbish. The problem was, I didn't set the cell encodding. So my code after I've fixed the problem looks like:
    HSSFCell cell = row.createCell((short)0);
    // And below is the line I was looking for
    cell.setEncoding(HSSFCell.ENCODING_UTF_16);
    cell.setCellValue("Some text with polish characters");
    Now it works great. Thanks anyway.

  • File adapter ISO-8859-1 encoding problems in XI 3.0

    We are using the XI 3.0 file adapter and are experiencing some XML encoding troubles.
    A SAP R/3 system is delivering an IDoc outbound. XI picks up the IDoc and converts it to an external defined .xml file. The .xml file is send to a connected ftp-server. At the remote FTP server the file is generating an error, as it is expected to arrive in ISO-8859-1 encoding. The Transfer Mode is set to Binary, File Type Text, and Encoding ISO-8859-1.
    The .xml file is encoded correctly in ISO-8859-1, but the problem is that the XML encoding declaration has the wrong value 'UTF-8'.
    Does anybody know of a work around, to change the encoding declaration to ‘ISO-8859-1’ in the message mapping program?

    An example of the XSL code might be as follow:
    <?xml version='1.0'?>
    <xsl:stylesheet 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>

  • Xslt ecc6  ISO-8859-1 problem when download xml file

    Hello,
    i create an ABAP test program:
    *& Report Z_ABAP_TO_XML                                             *
    *& Write the data from an internal ABAP table into an XML document, *
    *& and write it onto your frontend computer                         *
    REPORT z_abap_to_xml.
    TYPE-POOLS: abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\Users\Marco Consultant\Desktop\test.xml'.
    * This is the structure for the data to go into the XML file
    TYPES: BEGIN OF ts_person,
      cust_id(4)    TYPE n,
      firstname(20) TYPE c,
      lastname(20)  TYPE c,
    END OF ts_person.
    * Table for the XML content
    DATA: gt_itab        TYPE STANDARD TABLE OF char2048.
    * Table and work area for the data to fill the XML file with
    DATA: gt_person      TYPE STANDARD TABLE OF ts_person,
          gs_person      TYPE ts_person.
    * Source table that contains references
    * of the internal tables that go into the XML file
    DATA: gt_source_itab TYPE abap_trans_srcbind_tab,
          gs_source_wa   TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex      TYPE REF TO cx_root,
          gs_var_text    TYPE string.
    * Fill the internal table
    gs_person-cust_id   = '3'.
    gs_person-firstname = 'Bill'.
    gs_person-lastname  = 'Gates'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '4'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    * Fill the source table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IPERSON".
    GET REFERENCE OF gt_person INTO gs_source_wa-value.
    gs_source_wa-name = 'IPERSON'.
    APPEND gs_source_wa TO gt_source_itab.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION z_abap_to_xml
        SOURCE (gt_source_itab)
        RESULT XML gt_itab.
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Download the XML file to your client
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        not_supported_by_gui    = 22
        error_no_gui            = 23
        OTHERS                  = 24.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    and i created XSLT test conversion:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <CUSTOMERS>
          <xsl:apply-templates select="//IPERSON/item"/>
        </CUSTOMERS>
      </xsl:template>
      <xsl:template match="IPERSON/item">
        <item>
          <customer_id>
            <xsl:value-of select="CUST_ID"/>
          </customer_id>
          <first_name>
            <xsl:value-of select="FIRSTNAME"/>
          </first_name>
          <last_name>
            <xsl:value-of select="LASTNAME"/>
          </last_name>
        </item>
      </xsl:template>
    </xsl:transform>
    Seem all correct infact the program download  a file XML but the file have the encoding="UTF-16" also if i have specified "iso-8859-1" and if i tried to opend the xml file the file appears not correct because is generated with as first character "#", why?
    Below the xml generated..
    What i have to do to generate a correct XML without errors?
    #<?xml version="1.0" encoding="utf-16"?>
    <CUSTOMERS>
      <item>
        <customer_id>0003</customer_id>
        <first_name>Bill</first_name>
        <last_name>Gates</last_name>
      </item>
      <item>
        <customer_id>0004</customer_id>
        <first_name>Frodo</first_name>
        <last_name>Baggins</last_name>
      </item>
    </CUSTOMERS>

    hello all!
    i resolve the problem using:
    * Perform the XSLT stylesheet
      g_ixml = cl_ixml=>create( ).
      g_stream_factory = g_ixml->CREATE_STREAM_FACTORY( ).
      g_encoding = g_ixml->create_encoding( character_set = 'utf-16' "unicode
        byte_order = 0 ).
      resstream = g_stream_factory->CREATE_OSTREAM_ITABLE( table = gt_xml_itab ).
      call method resstream->set_encoding
        exporting encoding = g_encoding.
    I think it's the right way, i put all my ABAP program updated:
    *& Report Z_ABAP_TO_XML                                             *
    *& Write the data from an internal ABAP table into an XML document, *
    *& and write it onto your frontend computer                         *
    REPORT z_abap_to_xml.
    TYPE-POOLS: abap.
    CONSTANTS gs_file TYPE string VALUE 'C:UsersMarco ConsultantDesktop     est.xml'.
    data:  g_ixml type ref to if_ixml.
    data:  g_stream_factory type ref to IF_IXML_STREAM_FACTORY.
    data:  resstream type ref to if_ixml_ostream.
    data:  g_encoding type ref to if_ixml_encoding.
    * This is the structure for the data to go into the XML file
    TYPES: BEGIN OF ts_person,
      cust_id(4)    TYPE n,
      firstname(20) TYPE c,
      lastname(20)  TYPE c,
    END OF ts_person.
    * Table for the XML content
    DATA: gt_xml_itab        TYPE STANDARD TABLE OF char2048.
    * Table and work area for the data to fill the XML file with
    DATA: gt_person      TYPE STANDARD TABLE OF ts_person,
          gs_person      TYPE ts_person.
    * Source table that contains references
    * of the internal tables that go into the XML file
    DATA: gt_source_itab TYPE abap_trans_srcbind_tab,
          gs_source_wa   TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex      TYPE REF TO cx_root,
          gs_var_text    TYPE string.
    * Fill the internal table
    gs_person-cust_id   = '3'.
    gs_person-firstname = 'Bill'.
    gs_person-lastname  = 'Gates'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '4'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '5'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '6'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '7'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '8'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '9'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '10'.
    gs_person-firstname = 'Frodo'.
    gs_person-lastname  = 'Baggins'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '11'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    gs_person-cust_id   = '88'.
    gs_person-firstname = 'Frodoèé'.
    gs_person-lastname  = 'Baggins~¦Üu0192'.
    APPEND gs_person TO gt_person.
    * Fill the source table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IPERSON".
    GET REFERENCE OF gt_person INTO gs_source_wa-value.
    gs_source_wa-name = 'IPERSON'.
    APPEND gs_source_wa TO gt_source_itab.
    * Perform the XSLT stylesheet
      g_ixml = cl_ixml=>create( ).
      g_stream_factory = g_ixml->CREATE_STREAM_FACTORY( ).
      g_encoding = g_ixml->create_encoding( character_set = 'utf-16' "unicode
        byte_order = 0 ).
      resstream = g_stream_factory->CREATE_OSTREAM_ITABLE( table = gt_xml_itab ).
      call method resstream->set_encoding
        exporting encoding = g_encoding.
    TRY.
        CALL TRANSFORMATION z_abap_to_xml
        SOURCE (gt_source_itab)
        RESULT XML gt_xml_itab.
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Download the XML file to your client
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = gs_file
        FILETYPE                  = 'BIN'
      CHANGING
        data_tab                = gt_xml_itab
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        not_supported_by_gui    = 22
        error_no_gui            = 23
        OTHERS                  = 24.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *-- we don't need the stream any more, so let's close it...
    CALL METHOD resstream->CLOSE( ).
    CLEAR resstream.

  • IE 9 incorrectly encoding Unicode characters in URIs to ISO-8859-1 instead of UTF8

    Lets take the example word
    präsentation
    In Firefox, if I specify that as a CGI parameter, on the receiving end, I recieve:
    pr\\303\\244sentation
    which decoded as UTF-8 gives me: pr{U+00E4}sentation or my submitted word präsentation.
    What does IE give me, well let's see.
    pr\\344sentation
    which well, doesn't decode as UTF8 because 0o344 is 0xE4. 
    ä in Unicode is at the codeopint 0xE4. Which as we've seen above, encoded to UTF8 is
    0xC3 0xA4
    So question boils down to this.
    Why does IE9 use ISO-8859-1 instead of UTF8 for non-ASCII characters in URIs?

    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.

  • Problem when setting encoding to ISO-8859-1

    Hi. Is there something I'm missing when it comes to setting
    encoding? Here are the code in the mxml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    </Application>
    In the html-template I'm setting:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1" />
    The code for sending data from the app:
    <mx:HTTPService
    id="service"
    url="encoding.jsp"
    method="post"
    showBusyCursor="true"
    result="onResult(event)"
    resultFormat="xml"
    contentType="application/xml"
    fault="onFault(event)"
    useProxy="false" />
    public function send():void {
    var xml:XML = <Data>{data.text}</Data>;
    service.send(xml);
    But still the respons jsp I have made says it receives the
    data in UTF-8 format? What am I doing wrong?
    Servercode:
    don't work: BufferedReader reader = new BufferedReader( new
    InputStreamReader( is ) );
    work: BufferedReader reader = new BufferedReader( new
    InputStreamReader( is, "UTF-8") );

    Are there no-one who have the same problem? I've tried
    everything imaginable, and still the serverside receives the data
    as UTF-8.
    Is it supported at all to set the encoding of the
    request?

Maybe you are looking for

  • Imac freezes in sleep mode

    Ever since installing Lion my Imac freezes when in sleep mode. Has anyone had the same problem and been able to fix it

  • Ipad mini wifi cellular purchased in Germany Help !

    Can I use a ipad mini wifi cellular purchased in Germany when I go to UK if I buy a micro nano sim in UK ?

  • Putting music from Media Player into iTunes???

    So....I just recently bought my Nano. I have lots of songs on my computer (that I put on there from my CDs) in Windows Media Player 10. When I connected to iTunes (to put music on my iPod) some of my previous songs from Media Player were put into iTu

  • Labels Batch No allocation in Purchase requistion while MRP Run

    Dear Experts, While running the MRP PR are generated for labels as per BOM to purchase department, but in our case labels are purchased by purchase department, So can i give the batch number to purchase department through PR, so that they can print t

  • Automated Payment Program

    What is "Name of print dataset" in FBZP set up payment methods per country. Please explain with example. Also please let me know what is "seperate payment for each ref" in Paying co. codes in FBZP. Please explain with example