String unicode - Encoding used ?

Hi,
Can some one please provide me information on how is it working?
1) String uses unicode. Does it just stores unicode equivaluent or it
uses any encoding for storing the unicode value. I have got various
responses ranging from UTF-8 , UTF-16 to default encoding of the system.
2) If it doesn't uses default encoding of the system then please let me know how the following works
String x = "Some japanese character" // read from file using default encoding
Runtime.exec("echo" + x "> file") ; //
Who does the conversion from String 's encoding to platforms default encoding?
If the string doesn't uses encoding and stores it as unicode equivaluent , then also who does the converstion from unicode equivalent to platform's local encoding

http://java.sun.com/docs/books/tutorial/i18n/text/index.html

Similar Messages

  • Converting String to unicode encoded string

    Hi,
    I would like to convert non-ascii characters in a String or the whole string to unicode encoded character.
    For example:
    If i have some japanese character, I would like it to be converted to /uxxxx
    How can i do this? I don't want the exact character, as I am able to get that using getBytes("encoding format"). All i want is code point representation of the non ascii unicode characters.
    Any help to do this will be appreciated.
    Thanks in advance.

    I tried to do what that but I am not sure whether that is right or not.
    String inputStr = "some non ascii string";
    char[] charArray = inputStr.toCharArray();
    int code;
    StringBuffer sb = new StringBuffer();
    for(int i = 0; i < charArray.length; i++)
    code = (int) charArray;
    String hexString = Integer.toHexString( code );
    sb.append(hexString);
    System.out.println("Code point is "+sb.toString());
    My above code does not work as expected. Could you please tell me where i am goofing?
    Thanks!

  • Not able to display data in different columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.

    Hi Venkat,
    After extracting data into DSO check the request whether active or not.
    Check data in DSO in contents.
    If is there any restrictions on info providers in Queries.
    Let us know status clearly.......
    Reg
    Pra

  • Not able to display data in separate columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.
    This is an urgent need. Please help me out.

    Hi,
    I have no problem with item :P15_EV_LCL this is having a value my probem here is i am using java script to display the value in different color based on the condtion case
    eg:
    select
    case
    TRUNC((
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2)
    = :P15_EV_LCL
    then
    span style="background-color:lightgreen"
    || TRUNC((
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2) || '%' || /span
    else
    span style="background-color:yellow"
    || TRUNC(
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2) || '%' || /span
    end "Effort"
    from actuals Z
    If i dont use this <Span style="Background-color:color"> i am able to generate data in excel sheet if i use this color coding i am not able to get data in spread sheet.
    Please suggest
    Thanks
    Sudhir
    Edited by: Sudhir_N on Mar 23, 2009 10:00 PM

  • How to store text in AD attributes of type String(Unicode)

    In our company, we store the name of the building in which an employee works in one of the ActiveDirectory attributes named extensionAttribute# where # represents a number form 1-15.  I want to be able to store the names of buildings in the AD
    attribute named "buildingName". According to the
    buildingName attribute in the MSDN library, the syntax is "String(Unicode)".
    When I try something that seems simple to write some text into this attribute such as
    Set-QADUser jdoe -ObjectAttributes @{buildingName="My Building Name"}
    I get an error that says "Set-QADUser : The requested operation did not satisfy one or more constraints associated with the class of the object."
    I have been searching forums and code libraries for a solution to this issue, but I do not understand why I can't store string data into this attribute. I did try the following code snippets to try to convert the string to Unicode (and UTF-8) before I wrote
    to the buildingNameAttribute, but I still get the same error.
    $text = "My Building Name"
    $enc = [System.Text.Encoding]::Unicode
    # $enc = [System.Text.Encoding]::UTF8
    $encText = $enc.GetBytes($text)
    $encText
    Set-QADUser jdoe -ObjectAttributes @{buildingName=$encText}
    Has anyone else had this issue or know how to overcome it? I can, of course, continue to use the extensionAttribute in which I currently have the data stored, but I really want to free it up and use the "buildingName" attribute.
    Gardner Rowe Systems Analyst III UT MD Anderson Cancer Center - Making Cancer History

    From your link:
    buildingName attribute
    The name of the building where an organization or organizational unit is based.
    IOW, it is an attribute of organization or organizational unit class of object not a user object, so you can't set it for a user.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to upload Unicode encoding files from web?

    Hi everyone,
    I do not manage to upload Unicode encoding CSV files from web. Currently I use class CL_HTMLB_MANAGER to upload file from web. It works fine with ANSI encoding files, but file content is not uploaded correctly with Unicode encoding files. Especially I get innumerable characters u201C#u201D throughout the string that contains the file content (For example instead of u201CSAP CATALOG CSV 2.0u201D I get u201CÿþS#A#P# #C#A#T#A#L#O#G# #C#S#V# #2#.#0#u201D).
    I did not find in forums a solution to my issue that is why I am now asking for your help.
    How can I upload Unicode encoding files from web? Do you know another way to upload file from web that is Unicode compatible?
    Remark: I tried to upload Unicode encoding files from SAP GUI using function module GUI_UPLOAD and upload is successful.
    Here is the code that I currently used.
    DATA:     lr_event_ex     TYPE REF TO if_htmlb_data,
               fileupload      TYPE REF TO cl_htmlb_fileupload,
               lr_upload_model TYPE REF TO /ccm/cl_bsp_upload_model,
               lr_error        TYPE REF TO /ccm/cx_file_upload.
    lr_event_ex =  cl_htmlb_manager=>get_event_ex( runtime->server->request ).
    IF lr_event_ex->event_name = 'fileUpload' AND lr_event_ex->event_type = 'upload'.
      fileupload ?= lr_event_ex.
      FREE lr_event_ex.
    * get the model
      lr_upload_model ?= me->get_model( model_id = 'mupl' ).
      IF NOT fileupload->file_name IS INITIAL.
    *   upload data
        TRY.
            CALL METHOD lr_upload_model->upload_data
              EXPORTING
                iv_file_name = fileupload->file_name
              CHANGING
                cv_xcontent  = fileupload->file_content.
          CATCH /ccm/cx_file_upload INTO lr_error.
        ENDTRY.
        FREE fileupload.
      ENDIF.
    ENDIF.
    Thank you in advance for helping me.
    Best regards,
    Vanessa

    Hi There,
    Please check the details for the same.
    Link: http://helpx.adobe.com/creative-cloud/help/sync-files.html#Sync or upload files
    Troubleshoot sync:     
    Error: "Unable to sync files"
    Creative Cloud File Sync | Known issues
    Thanks,
    Atul Saini

  • String unicode -- understanding what is happening

    Hi,
    Can some one please explain how the following is working in string
    Case1:
    1) Assume I have set of bytes encoded in UTF-8.
    2)Iam reading the UTF-8 bytes using inputstreamreader and store it in string
    3) I know string stores it in unicode -- But what encoding? (UCS-2 or UTF-8 etc)
    Case 3:
    4) Suppose SJIS bytes are encoded using UTF-8 and Iam reading using UTF-8 and storing it in String and then printing it using System.out.println()(locale is set to SJIS), who does the converstion from Unicode representation of the string to SJIS
    Case 2:
    * Bytes are SJIS encoded
    * Read it using UTF-8 ( wrong encoding used to read)
    * Store it in string . How will it store?
    * Print it using System.out.println in a machine whose locale is set to SJIS.
    * Who is doing the conversin from unicode to SJIS

    Guessing...
    Case1:
    1) Assume I have set of bytes encoded in UTF-8.
    2)Iam reading the UTF-8 bytes using
    inputstreamreader and store it in string
    3) I know string stores it in unicode -- But what
    encoding? (UCS-2 or UTF-8 etc)
    Depends on how you 'store' it. If you use String explicitly then the default encoding of the system is used. If you use String explicitly with an encoding then that encoding is used.
    Most, but not all (bugs), implicit conversions for readers use the default encoding.
    Case 3:
    4) Suppose SJIS bytes are encoded using UTF-8 and Iam
    reading using UTF-8 and storing it in String and then
    printing it using System.out.println()(locale is set
    to SJIS), who does the converstion from Unicode
    representation of the string to SJIS
    What conversion? If it is a String then it is UTF-8. If you 'display' it then it uses the OS encoding.
    Case 2:
    * Bytes are SJIS encoded
    * Read it using UTF-8 ( wrong encoding used to
    o read)
    * Store it in string . How will it store?Garbage for the most part.
    * Print it using System.out.println in a machine
    e whose locale is set to SJIS.
    * Who is doing the conversin from unicode to SJIS
    Garbage in, Garbage out.
    By the way there is a Internationalization forum and presumably you could get answers there.

  • Help,DataInputStream and Unicode encoding problem

    Hello,everybody
    I am writing a small software for fun,but an problem about Unicode encoding stopped me. I tried to parse a file including integers,floats and Unicode characters(not UTF-8 but some other encoding type). I looked for the JDK documentation and I found that the class DataInputStream( implementing the interface DataInput) fitted my requirement best, then I tried but the Unicode characters are not read correctly( messy codes,only '????????').
    would you please help me? thanks a lot :-)

    the class DataInputStream has the methods useful to me, but find there is no method to set the encoding format ,both in DataInputStream and argument types used in its constructor:
    FileInputStream fis=new FileInputStream(fileName);
    DataInputStream     dis=new DataInputStream(fis);
    String line =dis.readLine();               System.out.println(line);
    // only "????????" output as result :-(
    I wonder how to set the encoding type,or another class.
    if I do it this way,it works,but there is no methods such as "readFloat","readInt",etc, so it's not what I want :
    FileInputStream fis=new FileInputStream(fileName);
    InputStreamReader read=new InputStreamReader(fis,"GB2312");
    BufferedReader reader=new BufferedReader(read);
    DataInputStream     dis=new DataInputStream(fis);
    String line = reader.readLine();
    System.out.println(line);
    thank you for your repley!

  • Dear sir! How can i judge a string's encoding?

    Dear sir! How can i judge a string's encoding?
    Now i receive a string !but i do not known what encoding this string is? I want a method to judge the encoding.
    Thank you!

    Strings in Java are by definition in Unicode. If you want to convert them to a specific encoding, you can do this:
    String yenSign = new String("\u00A5");
    byte[] yenByteArray = yenSign.getBytes("UTF8");
    Now yenByteArray is encoded into bytes using UTF-8.

  • Java unicode encoding

    hello,
    possibly this is very simple, so dont laugh. an application i'm writing displays an XML document as a JTree for editing. Within the XML document I have hardcoded Unicode IPA extensions, which show up perfectly in the JTree and JTextAreas. The problem is I dont know how to copy the original Unicode encoding into another document. I want to be able to write the original encoding (something like &#643;) to another file. As it is, it seems to be getting converted into a string and then when I copy it, the new document doesnt contain the Unicode and wont display the symbols. Thanks for any help

    I have the similar problem as you.
    I try to write an xml file encoded with UTF-8 to Unix Solaris. I have set locale to UTF-8 on Unix . I compile my java source under Windows machine with ant which javac is encoded in UTF-8. Database(Informix) is also set to UTF-8. I can enter special characters such as Spanish from web page and save to Database and bring it back to web page. It all displays correctly. But when i try to get the data with special characters from database and write a xml file into Unix and I use different editors such as Word, Notepad, Unix vi, UltraEditor to open this xml file, the content is all garbage. My code to write the xml file is :
    StringBuffer xml = new StringBuffer();
    xml.append(data from database);
    FileOutputStream fw = new FileOutputStream("test.xml");
    log.info("-----------System Encoding: " + System.getProperty("file.encoding") + "---------");
    OutputStreamWriter writer1 = new OutputStreamWriter(fw, "UTF-8");
    writer1.write(xml.toString());
    writer1.close();
    the log file displays System Encoding: UTF-8

  • Can I change Encoding used in InputStreamReader

    Hi Java Gurus:
    Wanted to know if I can somehow change the encoding used by InputStreamReader, the value of which I get by InputStreamReader.getEncoding().
    I did change file.encoding to UTF8, but that does not change the encoding used by InputStreamReader.
    I am getting garbage data when reading a chinese character from a Swing GUI. If I convert the string into a byte array using utf8 encoding, the bytes look OK, but when I print the string, it is all garbage and gets stored in the database (thru JDBC) as garbage (?)
    Any pointer(s) would be a great help guys!
    Thanks,
    Micky G

    Hi Mickey,
    Wanted to know if I can somehow change the encoding used by InputStreamReader,
    the value of which I get by InputStreamReader.getEncoding().Easiest way is to specify the Charset or Charset name String in the constructor,e.g.:
    InputStreamReader isr = new InputStreamReader(iStream,  "UTF-16")
    I am getting garbage data....I don't quite follow what you're describing in this paragraph. Can you elaborate?
    Regards,
    Joe

  • XML Character Encoding Using UTL_DBWS

    Hi,
    I have a database with WINDOWS-1252 character encoding. I'm using UTL_DBWS to call a web service method which echoes a given string. For this purpose, I do the following:
    DECLARE
        v_wsdl CONSTANT VARCHAR2(500) := 'http://myhost/myservice?wsdl';
        v_namespace CONSTANT VARCHAR2(500) := 'my.namespace';
        v_service_name CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MyService');
        v_service_port CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'MySoapServicePort');
        v_ping CONSTANT UTL_DBWS.QNAME := UTL_DBWS.to_qname(v_namespace, 'ping');
        v_wsdl_uri CONSTANT URITYPE := URIFACTORY.getURI(v_wsdl);
        v_str_request CONSTANT VARCHAR2(4000) :=
    '<?xml version="1.0" encoding="UTF-8" ?>
    <ping>
        <pingRequest>
            <echoData>Dev Team üöäß</echoData>
        </pingRequest>
    </ping>';
        v_service UTL_DBWS.SERVICE;
        v_call UTL_DBWS.CALL;
        v_request XMLTYPE := XMLTYPE (v_str_request);
        v_response SYS.XMLTYPE;
    BEGIN
        DBMS_JAVA.set_output(20000);
        UTL_DBWS.set_logger_level('FINE');
        v_service := UTL_DBWS.create_service(v_wsdl_uri, v_service_name);
        v_call := UTL_DBWS.create_call(v_service, v_service_port, v_ping);
        UTL_DBWS.set_property(v_call, 'oracle.webservices.charsetEncoding', 'UTF-8');
        v_response := UTL_DBWS.invoke(v_call, v_request);
        DBMS_OUTPUT.put_line(v_response.getStringVal());
        UTL_DBWS.release_call(v_call);
        UTL_DBWS.release_all_services;
    END;
    /Here is the SERVER OUTPUT:
    ServiceFacotory: oracle.j2ee.ws.client.ServiceFactoryImpl@a9deba8d
    WSDL: http://myhost/myservice?wsdl
    Service: oracle.j2ee.ws.client.dii.ConfiguredService@c881d39e
    *** Created service: -2121202561 - oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220 ***
    ServiceProxy.get(-2121202561) = oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@afb58220
    Collection Call info: port={my.namespace}MySoapServicePort, operation={my.namespace}ping, returnType={my.namespace}PingResponse, params count=1
    setProperty(oracle.webservices.charsetEncoding, UTF-8)
    dbwsproxy.add.map: ns, my.namespace
    Attribute 0: my.namespace: xmlns:ns, my.namespace
    dbwsproxy.lookup.map: ns, my.namespace
    createElement(ns:ping,null,my.namespace)
    dbwsproxy.add.soap.element.namespace: ns, my.namespace
    Attribute 0: my.namespace: xmlns:ns, my.namespace
    dbwsproxy.element.node.child.3: 1, null
    createElement(echoData,null,null)
    dbwsproxy.text.node.child.0: 3, Dev Team üöäß
    request:
    <ns:ping xmlns:ns="my.namespace">
       <pingRequest>
          <echoData>Dev Team üöäß</echoData>
       </pingRequest>
    </ns:ping>
    Jul 8, 2008 6:58:49 PM oracle.j2ee.ws.client.StreamingSender _sendImpl
    FINE: StreamingSender.response:<?xml version = '1.0' encoding = 'UTF-8'?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><ns0:pingResponse xmlns:ns0="my.namespace"><pingResponse><responseTimeMillis>0</responseTimeMillis><resultCode>0</resultCode><echoData>Dev Team üöäß</echoData></pingResponse></ns0:pingResponse></env:Body></env:Envelope>
    response:
    <ns0:pingResponse xmlns:ns0="my.namespace">
       <pingResponse>
          <responseTimeMillis>0</responseTimeMillis>
          <resultCode>0</resultCode>
          <echoData>Dev Team üöäß</echoData>
       </pingResponse>
    </ns0:pingResponse>As you can see the character encoding is broken in the request and in the response, i.e. the SOAP encoder does not take into consideration the UTF-8 encoding.
    I tracked down the problem to the method oracle.jpub.runtime.dbws.DbwsProxy.dom2SOAP(org.w3c.dom.Node, java.util.Hashtable); and more specifically to the calls of oracle.j2ee.ws.saaj.soap.soap11.SOAPFactory11.
    My question is: is there a way to make the SOAP encoder use the correct character encoding?
    Thanks a lot in advance!
    Greetings,
    Dimitar

    I found a workaround of the problem:
        v_response := XMLType(v_response.getBlobVal(NLS_CHARSET_ID('CHAR_CS')), NLS_CHARSET_ID('AL32UTF8'));Ugly, but I'm tired of decompiling and debugging Java classes ;)
    Greetings,
    Dimitar

  • Default Unicode encoding on SAP ERP?

    Hello there! Who could help me out and tell me where I can find official SAP information about what is the default Unicode encoding if I choose to install SAP ERP Unicode system. Is it UTF-8 or UTF-16? Installer does not ask this question, it just asks you to pick "Unicode" or "Non-Unicode". How can I find out if the database will be UTF-8 or UTF-16? Tried to find documents but could not find any. Any links to any official documentation that has the answer would be greatly appreciated!

    Hi Anand,
    Seems like you failed to complete the pre-installation steps...
    As far as i can see there a Mount access failure, meaning the shares or mounts necesary for the installation are either unavailable or the user <sap>sid don't have enough rights to use it.
    Check all your pre-intallation steps (included on the installation guide available at SAP Marketplace) and try it agian.
    regards
    Juan

  • Encoding using BASE64

    Hi All,
    i required some sample code for encoding using BASE64 encoding.
    can any one please help in doing the code for encoding a text.
    Thanks in advance.

    There are quite a few examples of Base64 encoders and decoders on the web. I didn't see any written in Obj-C or coded with a Cocoa interface, but perhaps you might find one if you spend some time searching.
    The example code you have is pure ANSI C, which means it can be added to any Xcode iPhone project as a separate file, wrapped into its own Obj-C class, or simply added to an existing class implementation. Since you only need to encode a short string, you'll only need the encode() and encodeblock() functions, along with the cb64[] array. encode() is expecting stdio FILE pointers for input and output, so you'll want to replace those parameters and the code which reads and writes from/to those streams with code that reads a C string (obtained from a NSString with UTF-8 encoding) and returns a NSData object.
    If you're not a C programmer, you will need to get some help from one, but it should be an easy job. Of course you should review the MIT license to make sure you're in compliance. But the reason I selected this example for you is that it's so well documented, it will teach you everything you need to know to write your own code from scratch if you need to.
    \- Ray
    p.s.: Here's some Cocoa code I found for you: [http://www.cocoadev.com/index.pl?BaseSixtyFour] - R

  • Unicode encoding

    Hi,
    We have a Non-Unicode System,Single Code Page configuration
    TCPDB: Database code pages    
    1100   SAP internal, like ISO 8859-1        (00697/00819)
    We have the processor architecture Big Endian 4102
    Oracle DB NLS_CHARACTERSET  WE8DEC
    What Unicode encoding will be using in this scenario?
    (UTF-8/CESU-8/UTF-16/UCS-2/UCS-4)?
    Regards,
    Etsg

    You can try this:
    Quit Mail, open Terminal and type:
    defaults write com.apple.mail NSPreferredMailCharset "UTF-8"
    Normally using a macron or any diacritics beyond what are in French and German should probably change you messages to UTF-8 automatically.

Maybe you are looking for

  • Could not getting field values from form

    hi, hellow, can you help me for solving the bellow problem i have form its enctype attribute of form tag is setted as multipart/form-data. when i am submiting this form, i call a request.getParameter(); in the submitting jsp file. But for any control

  • Adobe PDF not printing yosemite

    Just added new Officejet 5740 to home network, everything works except won't print Adobe PDF documents. Ok with Preview, .docx etc.  Running 10.10.1 on iMac.  Prints blank pages.  I have run into this in the past with my office HP Laser printer, but

  • Logial Partition modeling - How to extract data

    Hello Gurus, I know this topic is discussed manytimes in forum. Everybody talks of creating multiple cubes with Multiprovider on top of them. My Question is lets suppose, I have 3 Purchasing header cube each for year 2009,2010 and 2011 & future. How

  • Missing page header when exporting a Numbers sheet to PDF??

    I am running OS X 10.8.5 and Numbers 09 Version 2.3, all on a 2009 MBP. I created a simple table and have a page header (title, etc). When I print this file directly from Numbers to the printer, everything is okay. But when I export the file to PDF a

  • Internal number ranges in EHS

    Hi, For all number ranges in EHS I use Internal Number ranges. The current number range is: 0I     000000000001     899999999999     255 Output of number range in specification workbench e.g. is: 000000000225. Is it possible to use internal numbering