Set Encoding

I am trying to set the encoding of a dynamically created XML document that gets output from a JSP page. Every time I try the encoding is set to UTF-8. I need it set to UTF-16 (or just get rid of the encoding property all together).
Any help would be great.
Here is my code (the important stuff)
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(out);
Properties properties = transformer.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING,"UTF-16");
//properties.setProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
transformer.transform(source, result);
Thanks

how about:
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(out);
transformer.setOutputProperty("encoding", "utf-16");
transformer.transform(source, result);

Similar Messages

  • How to add a new character set encoding?

    Hello,
    can anybody please explain to me, how to add a new character set encoding to Mac OS Tiger?
    I have two Mac laptops, a new one with Snow Leopard and an older one with Tiger, and on the old one i cannot use or enable anywhere the "Russian (DOS)" character set encoding, which i need to be able to use some old text files.
    On the Snow Leopard, this encoding is present in the list of available encodings of TextWrangler, but not in TIger.
    If i have understood correctly, this is not a problem of TextWrangler, and the same encodings are available systemwide.
    So, the question is: how to add new encodings to Tiger (or to Mac OS in general)?
    Thanks.

    I think possibly that's in the Get Info window of Finder?
    I don't think either that or the input menu have any effect on available encoding choices. Adding languages to system prefs/international/languages can do that, but once you have added Russian there, I don't know of any way to add an additional Russian encoding (there are quite a number of them).

  • Set encoding in xml document

    Hi, I create org.dom4j.Document in java and I need set encoding to
    windows-1250, but I don't know how it do. I have always default encoding UTF-8.
    Document document = DocumentHelper.createDocument();
    Element zakazky = document.addElement(ZAKAZKY);
    <?xml version="1.0" encoding="UTF-8"?>
    <zakazky><zakazka><znacka_form>40708050001</znacka_form>......
    Thanks.

    This reply is a bit late (better late than never), but if anyone is stuck on this issue hopefully you can find this answer:
    You set the encoding when you use the Transformer class (when you output the XML)
    File file = new File("file.xml");
    OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(file), "windows-1250"); //I don't think you need to set it here, but you can if you like.
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer output = tf.newTransformer();
    StreamResult sr = new StreamResult(osw);
    output.setOutputProperty("encoding", "windows-1250");
    output.transform(ds, sr);By the way why do people say that Document has a method called getEncoding (and hence setEncoding) when it clearly doesn't - read your documents first before you start talking utter nonsense.
    Benjamin Black

  • 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?

  • Character  set Encoding

    Hi,
    Everybody i just want to know default character set encoding that is
    use to store data in oracle 9i..
    or is there any difference between Mssqi2005 character set encoding and oracle 9i character set encoding.
    please reply................
    regard's
    paritosh tomar

    DarkFiBrE72 wrote:
    Its AL16UTF16,
    From metalink
    Starting in Oracle 9i the National Characterset (NLS_NCHAR_CHARACTERSET) will be
    limited to UTF8 and AL16UTF16.
    For more details refer to The National Character Set in Oracle 9i and 10g
    Any other NLS_NCHAR_CHARACTERSET will no longer be supported.
    When upgrading to 10g the value of NLS_NCHAR_CHARACTERSET is based
    on value currently used in the Oracle8 version.
    If the NLS_NCHAR_CHARACTERSET is UTF8 then new it will stay UTF8.
    In all other cases the NLS_NCHAR_CHARACTERSET is changed to AL16UTF16
    and -if used- N-type data (= data in columns using NCHAR, NVARCHAR2 orNCLOB )
    may need to be converted.
    Edited by: DarkFiBrE72 on Sep 24, 2008 7:12 PMI'm not sure if the OP was referring to the National character set? Is this implied by the corresponding SQL Server characterset mentioned?
    Otherwise I would assume we are talking about the Database character set, which allows numerous different character sets and types (single-byte, multi-byte, Unicode etc. depending on Oracle release).
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How to change the character set encoding not being a superset one

    HI, i have a fresh installed database, but i realize the character set support in my client is not good enough, since its a not production database i want to change the character set encoding to anothor one not being a superset of the old one.
    I have tried the "ALTER DATABASE CHARACTER SET WE8MSWIN1252" but it fails claiming i need a superset one.
    I guess its just a single steps to do it, i have all the privileges, just not the time to reinstall and setup everything.

    Do you know what that does to the existing data, though? My hunch would be that any characters which have a different binary representation in the source & target character sets would be corrupted.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to set Encoding in ABAP Mapping

    Hi All,
    I have implemented ABAP Mapping in XI for converting Idoc into Idoc Flatfile which is provided by SAP and is in the below link.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    However after this mapping is taking place all chinese characters are being replaced by #.
    So i want to explicitly set encoding in this ABAP Mapping. Can anybody please tell me where to set Encoding and how in this ABAP Code?
    Regards,
    Dinakar

    Any help please. Urgent.
    Regards,
    Dinakar

  • How to set encoding for xml Marshaller?

    Hi,
    I am using SAPXMLToolkit. And I use XMLMarshaller to convert from xml to java classes (jaxb classes). Now when I get some characters like ü, the marshaller gives an error
    com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 69(:main:, row:1, col:323)
         at com.sap.engine.lib.xml.parser.readers.EncodedDataReader.read(EncodedDataReader.java:207)
         at com.sap.engine.lib.xml.parser.readers.EncodedDataReader.read(EncodedDataReader.java:205)
         at com.sap.engine.lib.xml.parser.helpers.AdvancedXMLStreamReader.read(AdvancedXMLStreamReader.java:152)
         at com.sap.engine.lib.xml.parser.XMLParser.scanCharData(XMLParser.java:1896)
         at com.sap.engine.lib.xml.parser.tokenizer.XMLTokenReaderImpl.next(XMLTokenReaderImpl.java:190)
    How do I solve this?? How do I set encoding for the marshaller?
    Regards,
    Guru

    Hi ogre,
    To set the encoding scheme for an XML document, you can use the createProcessingInstruction. Our CVIXML instrument driver (which
    is basically and user-friendly wrapper made around the MSXML interface) uses
    this method to specify the version of the XML document. So, what you could do
    is simply modify our existing CVIXML instrument driver to include the encoding.
    It's actually quite simple to do this.
    First off, open up the cvixml.c file
    located in the <CVI>\toolslib\toolbox directory in CVI. Then change the
    value of the constant XML_PROC_INSTR_DATA
    (located on line 42) from "version=\"1.0\"" to "version=\"1.0\"
    encoding=\"UTF-8\"". The save your source file and
    select Options >> Create Object file. This object file
    (cvixml.obj) is attached to your cvixml.fp function panel. 
    To test this out, you could simply use some code like
    CVIXMLNewDocument ("RootElement", &xmlDoc);
    CVIXMLSaveDocument (xmlDoc, 0, "C:\\Test.xml");
    Then the Test.xml document should say
    <?xml version="1.0" encoding="UTF-8"?>
    <RootElement/>
    Hope this helps!
    Best Regards,
    Jonathan N.
    National Instruments

  • How to use set_encoding method to set encoding in ABAP Mapping

    Hi All,
      Can anyone please let me know how to use set_encoding method in ABAP Mapping to set encoding.
      Any help would be greatly appreciable.
    Regards,
    Dinakar

    Hi Stefan,
    Thanks for your info. Let me try in ABAP Forum.
    Regards,
    Dinakar

  • Unable to set 'encoding' in XML prolog

    Hi, we're trying to set 'encoding' in an XML prolog with the following code in an 11.2 environment: -
    SQL> set serverout on size 1000000
    SQL> declare
    2 l_domnode dbms_xmldom.domnode;
    3 l_domdoc dbms_xmldom.domdocument;
    4 begin
    5 l_domdoc := dbms_xmldom.newdomdocument;
    6 l_domnode := dbms_xmldom.makenode( l_domdoc );
    7 dbms_xmldom.setversion( l_domdoc, '1.0' );
    8 dbms_xmldom.setcharset( l_domdoc, 'UTF-8' );
    9 dbms_output.put_line ( dbms_xmldom.getxmltype ( l_domdoc ).getstringval(
    10 end;
    11 /
    <?xml version="1.0"?>
    PL/SQL procedure successfully completed.
    what happened to the 'encoding' ?
    thx,

    Encoding iis a function of serialization....
    So
    #1. Don't use legacy methods (.getStringVal(), getClobVal()) to serialize in 11.x enviroment. Use XMLSerialize() instead.
    #2 XML Will be serialized in the client character set when displayed via SQL*PLUS. Oralce always encodes data into the character set requested by the client when dealing with Character date, so the actual value for the serialized XML and the value in the encoding could be different.
    #3. The onyl way to requestt a speciifc characeter set is to get a BLOB (Binary Large Object) based serialization of the XML. This is only possible when using a 'C' or Java API to access the serialized content. When requesting a BLOB based serialization XMLSerialze supports an ENCOIDING option, which allows you to request a specific encoding and which will add the requested encoding to the XML declaration.
    See many other posts on this subject..

  • Open Data Set Encoding

    Hello all,
    Can we specify Encoding in the OPEN DATA SET statement,i found out that we can encode it with UTF-8.
    but i want to encode my data in Latin1 ISO-8859-1.
    is it possible?
    if yes how to do it?
    plz help its urgent:(

    Hello Surmeet
    For me this sounds like that your string contains characters from two different encodings, e.g. ISO-8859-1 and ISO-8859-2.
    You could try to use option
    OPEN DATASET ... IGNORING CONVERSION ERRORS.
    Alternatively, you could surround the OPEN DATASET statement with a
    TRY.
      OPEN DATASET ...
    CATCH CX_SY_CONVERSION_CODEPAGE INTO lo_error.
      ld_msg = lo_error->get_text( ).  " get the message text
    ENDTRY.
    block and analyse the error message text. Hopefully you will find some hints to solve the problem.
    <i>Note</i>: For details refer to the ABAP keyword documentation of OPEN DATASET.
    Regards
      Uwe

  • How to set encoding in Apex Listener

    I have a problem conversion characters when using Apex listener
    The problem occurs in two different configurations:
    1. APEX Listener 2.0 running on GlassFish Server Open Source Edition 4.0 Oracle Database 11g Release 11.2.0.3.0 (NLS_LANGUAGE: AMERICAN, NLS_CHARACTERSET: AL32UTF8)
    2 . APEX Listener 2.0 running in standalone mode Oracle Database 10g Express Edition Release 10.2.0.1.0 (NLS_LANGUAGE: AMERICAN, NLS_CHARACTERSET: AL32UTF8)
    to demonstrate the problem I created a restful service, which is in the GET method returns the result of the query :
    select: p_param as "result" from dual
    parameter : p_param transmitted via http header
    parameter : p_param set to 'sample data дф ' , the last two characters - Cyrillic
    Http Request is as follows:
    GET http://xxx.xx.xxx.xxx:8080/apex/encode HTTP/1.1
    Accept-Encoding: gzip, deflate
    param: sample data дф
    Host: xxx.xx.xxx.xxx: 8080
    Connection: Keep-Alive
    User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
    in both cases, the return value - <result> sample data 4D </ result>
    I could not find documentation on how to avoid re-encoding?
    regards.

    With a WE8MSWIN1252 (or comparable charset) database, fronted by APEX listener, and the absense of NVARCHAR2 support in APEX, is there an option to build an APEX application supporting UTF-8 characters anyway, without converting the whole database to UTF-8?
    As "Application Builder User’s Guide" is quite tight-lipped when it comes to UTF-8 support, can somebody recommend an APEX FAQ concerning UTF-8 support in APEX?
    Thanks and regards, Tom

  • Won't Change Back to Regular Audio After Setting "Encoded Digital Audio"

    I have a first generation Mac Pro, and I've just recently upgraded to Lion. I used to play a fair bit of DVDs on the computer, but recently I've slacked off doing that. Today I popped in a DVD to play and then opened DVD Player up. Everything worked fine as it was supposed to. I've got the DVD player set to send digital audio out so I can get surround sound through my receiver. When I quit DVD player I don't get sound anymore through the optical out unless it's encoded digital audio. I've had that problem before, and to solve it I'd go to Audio Midi Setup and change the format to what it was prior to being set to "Encoded Digital Audio" by DVD Player. However, now with the upgrade to Lion it will not switch back. The option to do it is there, and I can click on 16, 20, or 24bit audio all day long and I won't get audio output from that port unless I restart the computer.
    This is obviously a system bug that needs to be reported to Apple if they aren't aware of it already, but what I'm wanting to know is how can I avoid restarting to get audio back? Restarting Core Audio doesn't do the trick as I've already tried that.

    From the iPod's Main Menu choose Videos -> Settings and make sure TV Out is set to Off.
    Otherwise, try a hard reset as well.  To do this, press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear.
    B-rock

  • How to set encoding of the file when using UTL_FILE

    Hi,
    We are using HRMS 11i applications. 11.5.10.2 version. Two languages are installed in our instance. American English and Canadian French.
    We have requirement to send employee details in a text file to third party vendor. We are using UTL_FILE to write details to the text file from PL/SQL procedure.
    The generated output file has encoding as "UTF8". Where as vendor is not able to process this file. They required encoding as "ANSI".
    How can we change the encoding to "ANSI" ?
    Values of character set parametrs are as follows.
    NLS_CHARACTERSET UTF8
    NLS_NCHAR_CHARACTERSET UTF8
    Any inputs are highly appreciated.
    Regards,
    Veerababu.

    You should take a look at the UTL_FILE documentation. As far as I know standard UTL_FILE calls write to the file system in the database character set. There are mirrored calls, but those write to the file system in UTF8.
    You may want to look at the UTL_RAW.CONVERT function. You may be able to use that in conjunction with the UTL_FILE.PUT_RAW API to write out data in the correct character set. To be honest, I've never tried this approach.
    Edited by: Centinul on Sep 21, 2012 8:16 AM

  • SDIXML_DOM_TO_XML - How to set Encoding - ANSI

    Hi,
    I am using SDIXML_DOM_TO_XML to generate XML File.
    I am using the method 'set_encoding' of IF_IXML_DOCUMENT
    to set the encoding format for the document.
    How to set the encoding format as ANSI for the document?
    Thanks & Regards,
    Abhishek

    also,
    I am trying to write the XML file to file in app.server.

  • How to set encoding for Web-To-Go??

    When the first launch of the Mobile Server (webtogo), there's a line showing the conversion for the charset encoding, like from MS950 to BIG5 for Chinese windows. Now I'm facing a problem where I need the encoding be UTF-8. Could someone please tell me where can I set this? Thank you very much for your help.

    Hi Celine,
    As I know, 1st your Oracle DB char set should be UTF8. 2nd Char set convertion is process in JAVA program.
    Regards
    Nicholas

Maybe you are looking for

  • EJB jar

    I have a web app with 2 components: 1) servlet and some jsp 2) Stateless Session bean in ejb jar In the jar are two packages 1 contains bean classes (home, remote, bean) the other helper classes. I the helper class package I'm unable to parse an xml

  • Relation between sales area and Taxes

    Dear All, I have come across an issue wherein for the customer, the Excise duties and Sales Tax flows in one Sales Area but does not flow if created in another. The Sales Org is different in both Sales Area, the material sold is same. Can anyone high

  • Please tell me the releasing date of iOS7

    Please tell me the releasing date of iOS7 Im asking about original version realese. Not beta.

  • Display Values in Graphs

    I am using performance point services for Project Server / SharePoint 2013, I have developed Analytical reports, I was wondering how the calculated values could appear on the graph instead of the tool tip

  • Its regarding Hiding / Making the specific excel file invisible or hidden

    I have used the following VBA code : 'Workbooks("Budget.xlsm").Windows(1).Visible = False 'Windows("Budget.xlsm").Visible = False Application.Visible = False The problem with the above code is that it makes all the opened excel file invisible and not