How to re encode UTF-16 to russian or something else

Hi,
My problem is following!
I have a UTF-16 bytes (from HTTP splitted with byte[] bytessplitted = abvaluea.getBytes( "UTF-16" );).
I am sure that it is UTF-16 because the given length from a example "string" is 14.
So when i want to display this now in a jsp i tried following:
<%= "UTF16 to German:"+new String(bytessplitted , "ISO8859_1")+"<br>"%>
result is:
��string
why is this!
Then i tried russian:
I entered: &#1103;&#1095;&#1089;&#1084;
Convert to bytes: from HTTP (UTF-16) splitted with byte[] bytessplitted = abvaluea.getBytes( "UTF-16" );
ReEncode: <%= "UTF16 to Russian:"+new String(bytess, "Cp1251")+"<br>"%>
result on the new jsp:
&#1102;&#1103;&#1057;&#1039;&#1057;�&#1057;&#1027;&#1056;&#1112;
Is my try false?
Please help me!
Gernot

new String(bytessplitted , "ISO8859_1")This bit of code says "Assume that bytessplitted was encoded using ISO*8859_1, and convert it to a String." Of course bytessplitted wasn't encoded that way, so it produces garbage. Likewise for your other conversion.
What JSP does with a string, when you output it via <%= %>, is to convert it to bytes using the encoding defined for the page it is producing. This means that all of that mucking about with Strings and byte arrays, besides being wrong and harmful to your data, is also pointless. All you need to do is make sure your page is encoded in UTF-8, then write your String data to the response object.

Similar Messages

  • I want to switch my user id with my rescue email address, how can i change my rescue email address to something else to free that up?

    i want to switch my user id with my rescue email address, how can i change my rescue email address to something else to free that up?

    Hi EllaBella0902,
    Welcome to the Support Communities!
    The information below may be able to answer your questions about how to change your rescue email address:
    Manage your Apple ID primary, rescue, alternate, and notification email addresses
    http://support.apple.com/kb/HT5620?viewlocale=en_US
    Before you make any changes, you may want to review the information in the Frequently Asked Questions section of this article:
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    This article explains how to update the information in the various services that use the Apple ID if you change it:
    Apple ID: What to do after you change your Apple ID
    http://support.apple.com/kb/HT5796?viewlocale=en_US&locale=en_US
    Cheers,
    - Judy

  • HT201376 I've erased and formatted the hard drive accordingly in order to reinstall OS X. everything went fine until about half way through the install. it just seems to stop. how long should this take? should i do something else to speed it up?

    I've erased and formatted the hard drive accordingly in order to reinstall OS X. everything went fine until about half way through the install. it just seems to stop. how long should this take? should i do something else to speed it up?

    About all you can do is wait until it finishes or you get an error message.

  • How to render animation to a MP4 format or something else?

    Hello. I usually render my animation to uncompressed AVI because after it I have to render it again with different software for video motage. So there wasn't any problem. But today I have to render my animation directly from After Effects. So I can't render it to uncompressed AVI anymore. I try render to MP4 format but that doesn't exsist. Even after wathich that tutorial below, I don't have that option what we can see in this video:
    So I try to do something else. And I found different format as QUICKTIME with H.264. But after render, I can't see my animation (I can see only voice, there is no video). What is strange because movies from Adobe Premiere rendered to H.264 codec work perectly! The same codec but if I render videos from After Effects I can't see it in Windows. But from Adobe Premeire I can. Strange!
    So I render my animation to QUICKTIME -> Motion-A format. And it works, I can see a whole rendered video now. But... 5 sec is over 150MB! And this is way to heavy.
    Please, tell me what I have to do to render my animation in a good preset.

    MP4 is the best format for what you describe.
    After Effects never did a good job of rendering to that format.
    Instead of wasting development time trying to make AE better at it, the After Effects team chose to let the Adobe Media Encoder team work on encoding things and they would work on making After Effects perform better and have better features.
    So, either render an intermediate file from AE and use that in the Adobe Media Encoder or send your AE comp directly to AME. Either way, you will use the Adobe Media Encoder to make an MP4. That's how I did it even when AE could make MP4's because AE wasn't good at making them. You can get better quality at smaller file sizes with AME. Go with it.
    Here's the Adobe team's official word on it: using Adobe Media Encoder to create H.264, MPEG-2, and WMV videos from After Effects
    They explain the proper workflow and they explain why they removed H.264 and WMV encoding from AE.

  • How do I Convert PDF file in browser to something else?

    Hi All
      How can I convert a PDF file coming up in browser to something else so I can print it on my epson printer. I looked in other forums and found something I tried, where you downloaded a converter, and I converted in to Jpeg among some other options it had, and printer would still not work, printer works on regular websites or on my notepad etc. but won't do the PDF file or would not print once I converted it to other things, can anyone help me. Thank you

    I don't understand why you cannot print that PDF document.
    What happens when you click on the Print icon on the upper-left side of the Adobe Reader browser plugin

  • How to put full HTML in an outputFormatted or something else?

    So i have a field that contains some html for example
    <p><strong>This is important</strong> so please read it<br/>And a second line</p>When i put this is in an outputFormatted:
    <af:outputFormatted value="#{myBean.value}" id="ot1"/>The text is shown on the page but when i look at the source, this is what i get:
    <p>This is important so please read it</p>As you can see, the strong tag has been removed and the second line is also gone...
    How can i achieve it so that everything is parsed exactly as i pass it? Or do i need another component instead of the outputFormatted?
    Edited by: Yannick Ongena on Sep 18, 2011 1:39 PM
    Edited by: Yannick Ongena on Sep 18, 2011 1:40 PM

    Yannick,
    af:outputFormatted is designed to only support certain HTML tags, and cleans up the rest (see [url http://download.oracle.com/docs/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_outputFormatted.html]the docs)
    You can use af:outputText with escape=false, just be sure to read [url http://download.oracle.com/docs/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_outputText.html]the docs and make sure you don't open yourself up to cross-site scripting attacks
    John

  • How do i link to an iframe, _self, or something else?

    I have a vetical menu and I want to set my links for each item to open in an iframe on the same page. Other than using html object, is there a way to set target information for hyperlinks. There doesn't appear any way to set the target as something other than what comes with Muse (other page, anchor) like '_self', '_top', etc.

    Hello,
    The only option you have in Muse is to open the page in either same tab or a new tab/Window.
    For this you need to Click on hyperlink at the top and check the box as shown in the image below :
    In case you are looking for any other option like _self or _top, I would suggest you to post this as a feature request on our "Ideas for features in Adobe Muse" section of the forums : http://forums.adobe.com/community/muse/ideas
    Regards,
    Sachin

  • SharePoint Calc Column - How to Find and Replace ANY & ALL Values with Something Else

    Haven't found a solution on this even though it seems like it should be cut and dry.
    I have a column containing characters "-" (e.g., XXX123-123-fjhrh-sdafsdfsd). I want to find every "-" and replace it with "@". Seems easy but so far haven't found a solution. My calc column always seems to stop at the first
    occurence of "-" and only replace that one. Seems every forumula wants you to tell SharePoint where to start (position). You can't simply tell SharePoint, Find this "-" ALL OCCURENCES and replace with this "@" ALL OCCURENCES.
    I don't have the option of saying start at this position because my data is not the same in every cell/field (e.g., number of characters).
    Closest I've gotten is this:
    =REPLACE([IN THIS COLUMN],FIND("-",[IN THIS COLUMN]),LEN("-","@")
    RESULTS:
    XXX@123-XXX-123

    Hi JJSHAREP,
    The formula only works when there are only three "-" in the column value, and the formula will fail if there are more than or less than three "-" in the column value.
    I recommend to use Jquery code to replace the characters in the column called IN THIS COLUMN in the UI:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    var Index=0;
    $(".ms-listviewtable tr th").each(function(i){
    if($(this).find("div").attr("name")=="IN_x0020_THIS_x0020_COLUMN"){
    Index=i;
    $(".ms-listviewtable tr").each(function(i){
    if(i>0){
    var value=$(this).find("td").eq(Index).text();
    var value1=value.replace(/\-/g, '@');
    $(this).find("td").eq(titleIndex).text(value1);
    </script>
    Best regards.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to remove ?xml version="1.0" encoding="UTF-8"? in receiver payload

    hi experts,
        how to remove <?xml version="1.0" encoding="UTF-8"?> from receiver payload.
    my source srtucture is ,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:entity-data xmlns:ns0="http://www.xxx.com">
    <Customer>
    <CustNo>xxx</CustNo>
    </Customer>
    </ns0:entity-data>
    in receiver payload i dont wont " <?xml version="1.0" encoding="UTF-8"?> "
    i want receiver payload
    <ns0:entity-data xmlns:ns0="http://www.xxx.com">
    <Customer>
    <CustNo>xxx</CustNo>
    </Customer>
    </ns0:entity-data>
    can any one provide me the solution for this.
    regards,
    ganesh

    hi vijayakumar,
         thanx for ur response....

  • How to insert ?xml version="1.0" encoding="utf-8"? before an element

    Hi, I have a message which must contain XML inside XML, this internal one must start off with the <?xml version="1.0" encoding="utf-8"?> string.
    Is there a nice trick for inserting this before an element? (not at the beginning of the mapping, a specific place further inside the XML).
    All of the other elements are mapped as part of the message type.

    Did you check Message Mapping : Play around with target structure .
    You can do this easily with UDF.
    public String setPrevalue(String var1,Container container) {
         StructureNode node = ((StructureNode) container.getParameter("STRUCTURE_NODE"));
         node.setPreValue("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
         return""; 

  • How to remove ?xml version="1.0" encoding="UTF-8"? .

    HI Experts,
                      i am doing one scenario file to file . in soruce payload i have <?xml version="1.0" encoding="UTF-8"?> . i want to remove <?xml version="1.0" encoding="UTF-8"?> at target side. is it possible .
    regards,
    alekhya.

    Hello,
    i want to remove <?xml version="1.0" encoding="UTF-8"?> at target side. is it possible .
    You can use XSLT and add
    <xsl:output method="text" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"/>
    in your output declaration
    Hope this helps,
    Mark

  • How to save a UTF-8 encoded text file ?

    hi People
    I have a little script which reads the source text from a layer and saves it to a .txt file. This is on a Mac and all was good until recently when I tried opening the .txt file on a PC in Notepad and found my ˚ degree symbols all whack.
    Resaving the .txt file in TextEdit as Unicode (UTF-8) encoding solved the problem, now opens fine in Notepad.
    But ideally I'd like the script to output the .txt as UTF-8 in the first place. It's currently Western (Mac OS Roman). I've tryed adding in myfile.encoding = "UTF8" but the resulting file is still Western (and the special charaters have wigged out again)
    any help greatly appreciated../daniel
        var theComp = app.project.activeItem;
        var dataRO = theComp.layer("dataRO").sourceText;
        // prompt user to save file
        var theFile = new File ("~/Desktop/"+ theComp.name + "_output.txt");
        theFile = theFile.saveDlg("Save an ASCII export file.");
        if (theFile != null) {          // check user didn't cancel dialog
            theFile.lineFeed = "windows";
            //theFile.encoding = "UTF8";
            theFile.open("w","TEXT","????");
            theFile.writeln("move details:");
            theFile.writeln(dataRO.value.toString());
        theFile.close();

    Hi,
    Got it, it seems, the utf-8 standard use 2-bytes (and more) encoding on accents and special characters.
    I found some info there with some code http://ivoronline.com/Coding/Theory/Tutorials/Encoding%20-%20Text%20-%20UTF%208.php
    However there was some error so I fixed it. (However for 3 and 4 bytes characters i didnt test it. So maybe you'll have to change back the 0xbf to 0x3f or something else.)
    So here is the code.
    Header 1
    function convertCharToUTF(character){
        var utfBytes = "";
        c = character.charCodeAt(0)
        if (c < 0x80) {
            utfBytes =  String.fromCharCode (c);
        else if (c < 0x800) {
            utfBytes =  String.fromCharCode (0xC0 | c>>6);
            utfBytes +=  String.fromCharCode (0x80 | c & 0xbF);
        else if (c < 0x10000) {
            utfBytes = String.fromCharCode (0xE0 | c>>12);
            utfBytes += String.fromCharCode (0x80 | c>>6 & 0xbF);
            utfBytes += String.fromCharCode (0x80 | c & 0xbF);
        else if (c < 0x200000) {
            utfBytes += String.fromCharCode (0xF0 | c>>18);
            utfBytes += String.fromCharCode (0x80 | c>>12 & 0xbF);
            utfBytes += String.fromCharCode (0x80 | c>>6 & 0xbF);
            utfBytes =+ String.fromCharCode (0x80 | c & 0xbF);
            return utfBytes
    function convertStringToUTF(stringToConvert){
        var utfString = ""
        for (var i = 0 ; i < stringToConvert.length; i++){
            utfString = utfString + convertCharToUTF(stringToConvert.charAt (i))
        return utfString;
    var theFile= new File("~/Desktop/_output.txt");
    theFile.open("w", "TEXT");
    theFile.encoding = "BINARY"
    theFile.linefeed = "Unix"
    theFile.write("");//or theFile.write(String.fromCharCode (0xEF) + String.fromCharCode (0xEB) + String.fromCharCode (0xBF)
    theFile.write(convertStringToUTF("Your stuff éàçËôù"));
    theFile.close();

  • HOW SPECIFY FILE.ENCODING=ANSI FORMAT IN J2SE ADAPTER.

    Hi All,
    we are using j2se plain adapter,   we need the outputdata in ANSI FORMAT.
    Default file.encoding=UTF-8
    how to achive this.
    thanks in advance.
    Regards,
    Mohamed Asif KP

    File adapter would behave in a similar fashion on J2ee. Providing u the link to ongoing discussion
    is ANSI ENCODING possible using file/j2see adapter
    Regards,
    Prateek

  • Adding  " ?xml version="1.0" encoding="UTF-8"? "   in generated xmls

    Hi,
    I am using xmlbeans framework to generate xmls , i am able to generate xml using document object but header "<?xml version="1.0" encoding="UTF-8"?>" is not coming in that xml file , how to include this in output xml files.

    Hi,
    I don't know the XMLBeans Framework, but this header is called XML declaration.
    In general there are options to configure this (i. e. setOption("omit-xml-declaration", false);).
    Anyway, I don't know the exact syntax in this framework but have a look at this, maybe it helps somehow.
    http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/XmlOptions.html#setSaveNoXmlDecl()
    Best Wishes
    esprimo

  • Printing ?xml version=\"1.0\" encoding=\"UTF-8\"? at the top of my xml

    Can anyone spot where I'm going wrong?
    I'm creating a DOMDocument like this:
    Document document = null;
    DocumentBuilder doc_builder = null;
    try
         doc_builder = factory.newDocumentBuilder();
    catch(ParserConfigurationException e){/* deal with exception*/}
    document = doc_builder.newDocument();Adding various stuff to it, then saving it like this
    Source source = new DOMSource(document);
    Result result = new StreamResult(idx);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.METHOD, "xml");
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //??????
    xformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
    xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    xformer.transform(source, result);All the usual stuff.
    But how do I get it to write:
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    at the top of the page?
    One further thing...
    If I have nothing to write in my xml file, it just spits out a blank file.
    Instead, I want it to write:
    <?xml version="1.0" encoding="UTF-8"?>
    <upIdx/>
    a simple:
    document.createElement("upIdx");doesn't appear to do anything if the block "upIdx" is subsequently empty.
    Many thanks

    duugggh....
    (well it is friday evening.. ... long week.. all that kind of stuff)
    how stupid of me....
    to answer my own question, it was here:
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); //??????
    xformer.setOutputProperty(OutputKeys.VERSION, "1.0");
    xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

Maybe you are looking for

  • Yoga 13 wifi is extremely poor

    Note: there is another thread about this marked "Solved" when it really wasn't. The original poster marked it that way, but the vast majority of people in that thread are still having problems with no response from Lenovo reps. Hopefully this new thr

  • Decent Mac OS 10.9 HP Officejet J6400 scanning software

    Up until Mountain Lion or Mavericks I used to use a nice scanning utility from HP called HP scan that added to the OS X built in capabilities for my OfficeJet device.  That software is not compatible with Mavericks and the scanning interface provided

  • How to use 'WPA2 Personal' only in a AEX network?

    In my AEX configuration, I specifically set the security to 'WPA2 Personal' only. When I join the network I choose WPA2 Personal. But when I look Preferences/Network/Airport/Advanced... it shows 'WPA Personal'. How can I use WPA2 Personal?

  • No boolean in the fields lists

    When I create a new database. There's no field name for boolean. or bool. I didn't see an option for making one or more fields as a true or false statement. and I wanted to see if some one had an idea about how to get some thing like this to work. Le

  • Inflated playcount after installing iPhone 3.0

    At first I thought this was just a bug with last.fm, but now I am thinking that it's a syncing issue. While using last.fm, it would scrobble my total playcount of a song every time instead of just the times that I listened to the song that day. I uni