Oracle 9i +Java: Change string encoding from UTF-16 to Windows-1251

Dear colleagues,
I have a very urgent case: need to change encoding of the string retrieved from the file (with encoding UTF-16) to Windows-1251 and put it to db table, to CLOB field.
Code of the Java function
+public static void file2table(String sql, String fileName, String characterSet, int asByteArray) throws SQLException, IOException {+
Connection con = null;
Writer writer = null;
Reader reader = null;
+try {+
con = getConnection();
PreparedStatement ps=con.prepareStatement(sql);
reader = new InputStreamReader(new BufferedInputStream(new FileInputStream(new File(fileName))), characterSet);
BufferedReader br = new BufferedReader(reader);
String s;
+while ((s = br.readLine()) != null) {+
byte[] defaultBytes=s.getBytes(characterSet);
String win1251str=new String(defaultBytes, "windows-1251");
+if(asByteArray>0) {+
ps.setBytes(1, defaultBytes);
+//ps.setBytes(1, win1251str.getBytes("windows-1251"));+
+} else {+
ps.setString(1, s);
+}+
ps.executeUpdate();
+}+
con.commit();
+} finally {+
+if (reader != null) {reader.close();}+
+if (con != null) {con.close();}+
+}+
+}+
I was check, all bytes from the file received correctly. But if I put readed bytes to database table, result text in table is broken.

>
Yes, currently I already have filled table with all file lines in result table but with incorrect encoding
>
No you haven't - not using the code you posted. You can't save LOB data using only the BLOB or CLOB.
That isn't data that you strored - it is garbage that is being stored as the LOB locator.
I ask you why you were trying to store the data that way instead of the way the doc shows you and you said
>
Because var. s is type of Java String.
For method setClob must be use type of CLOB
>
You are teriibly confused about LOBs. A BLOB or CLOB Java datatype is the LOB LOCATOR and doesn't contain any data.
Yes - it is true that method setClob must be of type CLOB but that CLOB instance HAS TO BE THE LOB LOCATOR - not the data.
You access LOB data using streams. To store LOB data you have to RETRIEVE (not send) a LOB locator from the database and then use the locator's stream to send the actual data.
So if you are creating a new record in the table you typically do an INSERT that includes an EMPTY_LOB() and have the newly created LOB locator returned to you. Then you use that locators stream to send the actual data.
Since you are not doing that your approach will not work.
Here is a link to the 9i JDBC Dev Guide
http://docs.oracle.com/cd/B10501_01/java.920/a96654.pdf
See page 8-2 to start with
>
BLOB and CLOB data is
accessed and referenced by using a locator, which is stored in the database table and
points to the BLOB or CLOB data, which is outside the table.
To work with LOB data, you must first obtain a LOB locator. Then you can read or
write LOB data and perform data manipulation. The following sections also
describe how to create and populate a LOB column in a table.
The oracle.sql.BLOB and CLOB classes implement the java.sql.Blob and
Clob interfaces, respectively (oracle.jdbc2.Blob and Clob interfaces under
JDK 1.1.x). By contrast, BFILE is an Oracle extension, without a corresponding
java.sql (or oracle.jdbc2) interface.
Instances of these classes contain only the locators for these datatypes, not the data.
After accessing the locators, you must perform some additional steps to access the
data. These steps are described in "Reading and Writing BLOB and CLOB Data" on
page 8-6 and "Reading BFILE Data" on page 8-22.
Note: You cannot construct BLOB, CLOB, or BFILE objects in your
JDBC application—you can only retrieve existing BLOBs, CLOBs,
or BFILEs from the database or create them using the
createTemporary() and empty_lob() methods.
>
Read the above quotes several times until you understand what they are telling you. These are the two main concepts you need to accept:
>
To work with LOB data, you must first obtain a LOB locator.
You cannot construct BLOB, CLOB, or BFILE objects in your JDBC application
>
See the example code and description starting on page 8-11 for how to populate a LOB column in a table
>
Create a BLOB or CLOB column in a table with the SQL CREATE TABLE statement,
then populate the LOB. This includes creating the LOB entry in the table, obtaining
the LOB locator, creating a file handler for the data (if you are reading the data from
a file), and then copying the data into the LOB.
>
Until you start using the proper methodology you are just wasting you time and will not be successful.

Similar Messages

  • Change character encoding from UTF-8 to EUC-KR

    We are receiving data in UTF-8 in the querystring from a partner formatted as:
    %EA%B3%A0%EB%AF%BC%ED%95%98%EC%9E%90%21
    Our site uses EUC-KR so using this text for search/display/etc is not possible. Does anyone know how we can convert this to the proper Korean EUC encoding so it can be displayed properly using JSP? Basically it should be:
    %B0%ED%B9%CE%C7%CF%C0%DA%21
    Thanks in advance.

    I'm not sure where you are getting %xx encoded UTF-8.... Is it cuz you have it in a GET method form and that's what you are seeing in the browser's location bar? ...
    Let's assume you have a form on a page, and the page's charset is set to UTF-8, and you want to generate a URL encoded string (%xx format, although URLEncoder will not encode ASCII chars that way...).
    In the page processing the form, you need to do this:
    request.setCharacterEncoding("UTF-8"); // makes bytes read as UTF-8 strings(assumes that the form page was properly set to the UTF-8 charset)
    String fieldValue = request.getParameter("fieldName"); // get value
    // the value is now a Unicode String in Java, generated from reading the bytes submitted from the form as UTF-8 encoded text...
    String utf8EncString = URLEncoder.encode(fieldValue, "UTF-8");
    // now utf8EncString is a URL encoded (%xx) string of UTF-8 values
    String euckrEncString = URLEncoder.encode(fieldValue, "EUC-KR");
    // now euckrEncString is a URL encoded (%xx) string of EUC-KR valuesWhat is probably screwing things up for you mostly is this:
    euckrValue = new String(utf8Value.getBytes(), "EUC-KR");
    What this does is takes the bytes of the string utf8Value (which is not really UTF-8... see below) in the local encoding (possibly Cp1252 (Windows) or ISO8895-1 (Linux), or EUC-KR if it's Korean Windows), and then reads them as if they were EUC-KR... which they aren't.
    The key here is that Strings in Java are not of any encoding. They are pure Unicode values. Encodings only matter when converting to or from bytes. The strings stored in a file or sent over the net have to convert to bytes since that's what is stored/sent, just bytes. The encoding defines how the characters can be encoded into 1 or more bytes, and thus reconstructed.

  • Change db2 encoding to utf in String field

    Hi Gurus,
    We need to retrieve a field from db2 and send it to Siebel via Web Service in order to insert that data. We are having trouble with the encoding and we were wondering if there is any function to change encoding from db2 to utf so we can add it to our xml.
    We believe that changing the encoding will insert it propperly in Siebel.
    Thank you very much,
    Alvaro

    Hi Alvaro,
    What is the technology of your staging area ?
    In Oracle, you have a function to do that kind of change : http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions027.htm .
    If your staging is not Oracle, you can probably find something similar.
    You can apply it to all your string mappings. If you always use that function for string data with these technology, you can also edit your KM and put the function in it.
    Regards,
    JeromeFr

  • Changing the xml encoding from UTF-8 to ISO-8859-1

    Hi,
    I have created an xml file in xMII transaction that I feed into a webservice as input. As of now, the data in the xml file is entirely english text (it would be changing to have European text soon).  I gave the encoding as UTF-8.
    I get an error on the webservice side(not xMII code) that the its not able to parse. The error is 'SaxParseException: Invalid 1 of 1-byte UTF-8 sequence). I know that an easy fix is if tI change the encoding to iso-8859-1.
    But the reference document doesnot let me put anythign other than UTF-8. Even if I put <?xml version="1.0" encoding="iso-8859-1"?> as the first line, when I save it and open it back, i see <?xml version="1.0" encoding="UTF-8"?>
    Is there any way to change the encoding? Or better still, anyway idea why this invalid sequence is coming from?
    Thanks,
    Ravi.

    Hi Ravi,
    We have encountered scenarios where we needed to take the <?xml version="1.0" encoding="UTF-8"?> out completely.  As xMII was providing the Web Service, it needed a workaround.
    In your case, it seems that you wish to pass it from xMII to an external Web Service provider.  One option might be to pass the XML document as string.
    Once you convert it to a string, it may escape all XMl characters (i.e. '<' into '&lt;').  You could perform a string manipulation and remove the <?xml version="1.0" encoding="UTF-8"?> from the string.  You may also need to play around with xmlDecode( string ) function in the Link Editor.
    I would suggest that before you try this option, create a string variable will the contents, but without the <?xml version="1.0" encoding="UTF-8"?> and try assigning it to the input.
    You may also wish to try a string variable that has <?xml version="1.0" encoding="iso-8859-1"?> as the first line.  If this works, you should be able to perform string manipulations to convert your XML document into this modified string.
    Cheers,
    Jai.

  • Change encoding from utf-8 to ISO-8859-1

    Hi
    I have a problem with changeing the encoding of a text. The text is in utf-8, but when I try to send the text as mail with javax.mail and "text/html", Outlook doesn't want to display the right characters. Can somebody help me?

    Hi,
    String s = java.net.URLEncoder.encode(myText, newencoding)
    http://galileo.spaceports.com/~ibidris/

  • IsSchemaValid does chang the xml-encoding header from UTF-8 to WINDOWS-1252

    I found the following effect:
    isSchemaValid does changing the encoding - entry of the xml-file-header
    generating xml-file by using DBMS_XMLGEN :
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    with the header of the file is
    <?xml version="1.0" encoding="UTF-8"?>
    change the xmldoc to a xmlType
    and validate it against the schema
    xmldoc_xmlType:=(xmltype(xmldoc)) ;
    xmldoc_xmlType.isSchemaValid ( bSchemalocation)
    after this the header of the file is
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    my DB:
    R11_2_0_2 / Windows 64
    the same in
    R11_2_0_1 / Windows 32
    select name, value from v$parameter where upper(name) like '%NLS%'
    nls_calendar     
    nls_comp          BINARY
    nls_currency     
    nls_date_format     
    nls_date_language     
    nls_dual_currency     
    nls_iso_currency     
    nls_language          AMERICAN
    nls_length_semantics     BYTE
    nls_nchar_conv_excp     FALSE
    nls_numeric_characters     
    nls_sort     
    nls_territory          AMERICA
    nls_time_format     
    nls_timestamp_format     
    nls_timestamp_tz_format     
    nls_time_tz_format     
    register my schema by:
    dbms_xmlschema.registerSchema(
    schemaurl => vschemaurl,
    schemadoc => xsd_file,
    local      => FALSE,      
    gentypes      => TRUE,      
    genbean      => FALSE,      
    gentables      => TRUE,      
    force      => FALSE,
    owner      => dbuser
    ,CSID      => nls_charset_id('AL32UTF8')
    How can I let or change back the xml-encoding entry to UTF-8 ?
    regards

    Your solution should not be relied upon...
    C:\Temp>sqlplus /nolog @t1 %CD%
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 4 09:41:32 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def XMLDIR = &1
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:00:00.24
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.07
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> create or replace directory XMLDIR as '&XMLDIR'
      2  /
    old   1: create or replace directory XMLDIR as '&XMLDIR'
    new   1: create or replace directory XMLDIR as 'C:\Temp'
    Directory created.
    Elapsed: 00:00:00.00
    SQL> create table XML_DEFAULT of XMLTYPE
      2  /
    Table created.
    Elapsed: 00:00:00.11
    SQL> create table XML_CLOB of XMLTYPE
      2  XMLTYPE store as CLOB
      3  /
    Table created.
    Elapsed: 00:00:00.01
    SQL> select *
      2    from nls_database_parameters
      3   where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET')
      4  /
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CHARACTERSET               AL32UTF8
    Elapsed: 00:00:00.02
    SQL> declare
      2    XML_DEFAULT XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      3    XML_CLOB    XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      4  begin
      5    delete XML_DEFAULT;
      6    delete XML_CLOB;
      7    insert into XML_DEFAULT values (XML_DEFAULT);
      8    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT.xml');
      9    IF  XML_DEFAULT.isSchemaValid ( 'SCHEMALOCATION_DOES_NO_MATTER_FOR_TEST_CASE.XSD', 'SCHEMA_NO_MATTER') = 1 THEN  null; ELSE  null; END IF;
    10    commit;
    11    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_IS_VALID.xml',nls_charset_id('WE8MSWIN1252'));
    12    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_WIN1252.xml');
    13    insert into XML_CLOB values (XML_CLOB);
    14    dbms_xslprocessor.clob2file( XML_CLOB.getclobval() , 'XMLDIR','XML_CLOB.xml');
    15    commit;
    16  end ;
    17  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.27
    SQL> --
    SQL> host type XML_DEFAULT.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_IS_VALID.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_WIN1252.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_CLOB.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL>First, the character set changes because isSchemaValid() causes the document to be parsed and converted to the internal database character set, as does storing it in a table.
    It appear that your solution works in SQL because the semantics of SQL are such that it causes a 'copy' of the XMLType to take place before running the isSchemaValid() processing, were we to optimize away that copy as a result of a patch or performance optimization project then you solution would break...
    If you want the output in a particular character set you should force that using XMLSerialize or getBlobVal(charsetid). Unfortunately we don't have a convience method for writing BLOBS on DBMS_XSLPROCESSOR...

  • 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

  • Encoding from UTF-8 encoded String to Microsoft Project default encode

    Hi Expert ...
    I have a problem with encoding a String from UTF-8 String in order to write a MPX (Microsoft Project) file. I used UTF-8 on my Database encoding, and I want to write a MPX file using MPXJ library, but the result is (?) character. I think it's because I didn't encode yet to Shift JIS (a Microsoft Product default encoding). And after that I try to encode the String with Shift_JIS encoding, but the same result is appeared. I try to looking another way, but there is no result.
    I hope some expert would help me to solve this problem.
    Thank you,
    Alfian B.

    Totally wrong. A String doesn't have an encoding.
    Now if you had an array of bytes, which were encoded using one charset, and you wanted to convert that to an array of bytes encoded using a second charset, you would use code like this:byte[] bytes = // the bytes encoded in UTF-8, let's say
    String s = new String(bytes, "UTF-8"); // make that into a String
    byte[] newbytes = s.getBytes("windows-31j"); // encode the String into windows-31j

  • Oracle 11gr2 - change character set from utf-8 to weiso8859p15

    Hi guys,
    I've a new and empty oracle 11gr2 database for my test environment, during the installation i've choosed the UTF-8 character's set but now i've see that in the production environment there is the WEISO8859 character's set.
    I have a dump of the prod. env. (done with Exp function).
    How can I change the character set from utf-8 to weiso8859p15 ?
    I found this procedure:
    SHUTDOWN IMMEDIATE or a SHUTDOWN NORMAL;
    STARTUP MOUNT;
    ALTER SYSTEM ENABLE RESTRICTED SESSION;
    ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
    ALTER SYSTEM SET AQ_TM_PROCESSES=0;
    ALTER DATABASE OPEN;
    ALTER DATABASE NATIONAL CHARACTER SET new_character_set;
    SHUTDOWN IMMEDIATE; -- or SHUTDOWN NORMAL;
    STARTUP;
    is it correct ?
    Thx.
    Kind Regards,
    Stefano.

    evil.stefano wrote:
    Hi guys,
    I've a new and empty oracle 11gr2 database for my test environment, during the installation i've choosed the UTF-8 character's set but now i've see that in the production environment there is the WEISO8859 character's set.
    I have a dump of the prod. env. (done with Exp function).
    How can I change the character set from utf-8 to weiso8859p15 ?
    I found this procedure:
    SHUTDOWN IMMEDIATE or a SHUTDOWN NORMAL;
    STARTUP MOUNT;
    ALTER SYSTEM ENABLE RESTRICTED SESSION;
    ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
    ALTER SYSTEM SET AQ_TM_PROCESSES=0;
    ALTER DATABASE OPEN;
    ALTER DATABASE NATIONAL CHARACTER SET new_character_set;
    SHUTDOWN IMMEDIATE; -- or SHUTDOWN NORMAL;
    STARTUP;
    is it correct ?NO
    leave the character set alone.
    UTF-8 will not be a problem.

  • Xml payload encoding from utf to iso

    Hi Experts,
    Could you please let me know how can I encode he xml payload from utf-8 to ISO-8859-1.
    its bit urgent any help is appreciated.
    Thanks & Regards,
    Ranganath.

    Hi Ranganath,
    Here is the java mapping for PI 7.1 and above which will transform encoding type from utf-8 to ISO-8859-1.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class addAttributeToTag2 extends AbstractTransformation {
          * @param args
         public void execute(InputStream in, OutputStream out)
                   throws StreamTransformationException {
              // TODO Auto-generated method stub
              try
                   int c;
                   int count=0;
                   String s="";
                   while(1>0)
                        c=in.read();
                        if(c<0)
                             break;
                        if(count<=2 && (char)c=='?')
                             count++;
                        if(count<=2)
                             s=s+(char)c;
                             if(count==2)
                                  s=s.replaceAll("utf-8","ISO-8859-1");
                                  s=s.replaceAll("UTF-8","ISO-8859-1");
                                  count=3;
                                  out.write(s.getBytes());
                             continue;
                        out.write(c);
                        //System.out.print((char)c);
                   in.close();
                   out.close();
              catch(Exception e)
         public void setParameter(Map arg0) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try{
                   addAttributeToTag2 genFormat=new addAttributeToTag2();
                   FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\copy.xml");
                   FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\copy1.xml");
                   genFormat.execute(in,out);
                   catch(Exception e)
                   e.printStackTrace();
         public void transform(TransformationInput arg0, TransformationOutput arg1)
                   throws StreamTransformationException {
              this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    if you are working in PI 7.0 the you need following code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class addAttributeToTag2 implements StreamTransformation {
          * @param args
         public void execute(InputStream in, OutputStream out)
                   throws StreamTransformationException {
              // TODO Auto-generated method stub
              try
                   int c;
                   int count=0;
                   String s="";
                   while(1>0)
                        c=in.read();
                        if(c<0)
                             break;
                        if(count<=2 && (char)c=='?')
                             count++;
                        if(count<=2)
                             s=s+(char)c;
                             if(count==2)
                                  s=s.replaceAll("utf-8","ISO-8859-1");
                                  s=s.replaceAll("UTF-8","ISO-8859-1");
                                  count=3;
                                  out.write(s.getBytes());
                             continue;
                        out.write(c);
                        //System.out.print((char)c);
                   in.close();
                   out.close();
              catch(Exception e)
         public void setParameter(Map arg0) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try{
                   addAttributeToTag2 genFormat=new addAttributeToTag2();
                   FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\copy.xml");
                   FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\copy1.xml");
                   genFormat.execute(in,out);
                   catch(Exception e)
                   e.printStackTrace();
    However as Krish has pointedf out file adapter has option to set encoding type, you can try that option first.
    regards
    Anupam

  • Encoding from UTF-16 to UTF-8

    Hi,
    I need to convert from UTF-16 to UTF-8 encoding.
    I receive an CSV file in encoding UTF-16 for our backend system. but our external partner needs the encoding to be UTF-8
    How can I change the encoding ?

    Hello Frank,
    We have used TextCodePageConversionBean to meet such a requirement in one of our scenarios using CSV files.
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2deb47812e98e10000000a155369/content.htm
    Can you please try this and let us know if this helps?
    Thanks.
    Best Regards,
    Shweta

  • Unable to set JVM file encoding to UTF-8 on Windows

    Hi,
    I am running Tomcat on 1.5.0_05 JRE. I tried several things to set the jvm file encoding to UTF-8 instead of the default Cp1252, but no luck yet.
    The most intuitive approach seems to be to use a JVM option like
    "-Dfile.encoding=UTF-8"
    but this does not seem to have any effect. I have a WinXP pro m/c. I saw some bug reports which seemed to indicate that changing the JVM file encoding is not an available feature....is that correct? I would really appreciate any help/pointers on this. I will post the solution if I find something in the meantime.
    Thanks,
    Sriram

    I am fail to set it too. I think it is better to separate the file.encoding into two, one for accept local OS, the other for compile .java and .jsp and so on files. So we can change it and the bugs will be decrease!

  • Change encoding from utf-8 to iso-8859-1 in JMS receiver!

    Hi.
    I have some problems regarding encoding.
    The simple setup: dummy datatype as input, XSLT mapping and standard XI output(to JMS).
    Are there any way to tell the JMS adapter to deliver the message in iso-8859-1 and not utf-8?
    Regards Peter

    > Hi Henrique.
    >
    > This sounds like an idea. Can you guide me to some
    > documentation, that describes adding mapping in the
    > jms adapter module?
    >
    > Regards Peter
    To use modules in JMS adapter: http://help.sap.com/saphelp_nw2004s/helpdata/en/0f/80243b4a66ae0ce10000000a11402f/frameset.htm
    Now, you add the MessageTransforBean module, to use the XSLT mapping. Check the end of this blog to learn how to use XSLT mapping on MessageTransformBean: /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    Regards,
    Henrique.

  • Change XML Encoding to UTF-8

    Dear SDNers:
    Hello!
    I face an issue of sending some XML documents from SAP to a non SAP System. This non SAP System stores XML documents in UTF-8 encoding format. When I create an XML document using CALL TRANSFORMATION in ABAP, the XML code generated has encoding as "ISO-...". Could anyone of you please guide me on how to have this changed to UTF-8?
    In case of no solution, I would eventually have to pick the XML generated code and replace the "ISO-..." thing with "UTF-8" at runtime within the program. However, I feel that's not a quality method.
    So, if anyone of you can suggest/opine of something better, it would be truly appreciated and rewarded.
    Have a Nice Day!
    Vivek.

    Hello Uwe:
    Currently we are on 6.20. But an upgrade is very near and I should expect these Classes to be handy then. I will explore them individually and post back. However, regarding my issue: the XML code generated by program is something like:
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><SOURCE>42</SOURCE>
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><SOURCE>42</SOURCE>.......
    My need here is to replace the - encoding="iso-8859-1" with "UTF-8". So if you suggest proper methods to do so then it will be a good step for me.
    Thanks for the relevant information anyways.
    Have a nice day!

  • How to change default encoding in DataBindings.cpx

    Hello,
    How to change default encoding in DataBindings.cpx,
    on windows-1251 for instance?

    I've filed Bug# 3147045 for this. Our DataBinding.cpx file and UIModel XML files seem to be getting hardcoded to use the ISO-8859-1 encoding. Our ADF Business Components XML files correctly pickup the IDE encoding.

Maybe you are looking for

  • Guest domain obp alias changed after upgrade to 1.0.3

    Hello all, Recently upgraded from 1.0.1 to 1.0.3 (and firmware to 6.6.5) using the procedure at http://blogs.sun.com/jbeloro/entry/upgrading_from_ldoms_1_0. I found that my boot-device setting on all guest domains no longer worked. They were set to "

  • How do I get the photos id numbers to reappear in the viewer display?

    Hi, Somehow all the image numbers which appear just below the thumbnails of all my photos in the viewer have disappeared. Presently, I have to click on the photo and find its number by going to INFO. Can someone please tell me how to get the numbers

  • Preview (copy text) results in SQUIGGLES not text for certain PDFs

    hi - problem is "copy text and paste from certain PDFs result in squiggles When i use an online converter service (e.g. http://ebook.online-convert.com/convert-to-pdf) to convert files to PDF, Apple Preview does not work properly. What happens is, wh

  • MY IBOOK IS FROZEN. WHAT DO I DO?

    The iBook on my Ipad is frozen. What do I do?

  • With Apple Photos app

    Since trying to migrate 43k photos in about 200 albums to the new Apple Photo App my Apple TV is showing only a small random assortment of photos and no longer albums. This was a ten year project of putting together family albums of family events. It