Chinese character using HttpURLConnection

Hi,
I am trying to retrieve a chinese page using HttpURLConnection and as a result getting all chinese characters as ???.
I know it has to be something with the fonts but cannot figure out exactly what. Any help in this regard will be great.
Below is my sample code...
URL connect = new URL("http://chinese.site.url");
HttpURLConnection connect = (HttpURLConnection) connect.openConnection();
connect.setRequestProperty("content-type", "text/html;charset=gb2312");
BufferedReader in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
String inputLine;
while ( (inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}

Hi,
I am trying to retrieve a chinese page using
HttpURLConnection and as a result getting all chinese
characters as ???.
I know it has to be something with the fonts but
cannot figure out exactly what. Any help in this
regard will be great.
Below is my sample code...
URL connect = new URL("http://chinese.site.url");
HttpURLConnection connect = (HttpURLConnection)
connect.openConnection();
connect.setRequestProperty("content-type",
"text/html;charset=gb2312");
BufferedReader in = new BufferedReader(new
InputStreamReader(connect.getInputStream()));
String inputLine;
while ( (inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}u forgot to set the encoding for the inputstreamreader.
     public static String readTextFiles (String filename)     {
          String data="";
          File file = new File(filename);
          char[] chars = new char[(int) file.length()];
          try {
               FileInputStream readingfile = new FileInputStream(file);
               BufferedReader in = new BufferedReader(new InputStreamReader(readingfile, "gb2312"));
               in.read(chars);          // org
               in.close();
          } catch (FileNotFoundException e) {
                System.out.println("File Not Found " + e.getMessage());
          } catch (IOException e) {
                System.out.println("IO exce " + e.getMessage());
          data = new String(chars);
          return data;
     }     // end readTextFile

Similar Messages

  • How to download the chinese character using GUI_DOWNLOAD

    How to download the chinese character using GUI_DOWNLOAD from SAP 4.6c

    Hi,
       Make sure that the chinese font is installed in your system, because when you download in excel, the character formats are taken from the Frontend.  For detail see the below thread.
    [link1|Re: Download Chinese character]
    Thanks,
    Asit Purbey.

  • Inserting Chinese character using sqlplus

    I am not able to insert Chinese character using sqlplus .
    Am getting disconnected when trying to insert.
    with no error
    message coming
    is disconnected form oracle enterpise 10.2.0.2.0 with .. mining..
    Please help.

    sql is simple insert statement
    insert into t5(txt) values ('中中 中 中 中 中 中 中 中 中 ');
    os is AIX
    I wonder when i using sql developer I am able to insert.
    regarding environmental variable , I am not setting any variable regarding NLS.
    I simply connect sqlplus username/password
    when I execute following statement
    sqlplus disconnect without giving any error.
    question is why sql developer is able able to insert and sqlplus not
    Thanks for reply

  • GUI Download Chinese Character to Excel gibberish character

    Hi Experts,
    I'm facing a problem where I'm using FM gui_download to save Chinese Character into Excel file.
    Upon double click to open the excel file, funny character shows up.
    But if I were to open the same file using a blank Ms Excel application (Go to File->Open->choose file),
    Excel will prompt me to select a proper encoding (GB2312 in this case), and the Chinese character can be seen thereafter.
    But, my user doesn't want to go through this.
    I've browsed through the forum and someone has posted about this before and it's unanswered.
    How to download the chinese character using GUI_DOWNLOAD - unanswered
    And, Re: GUI_DOWNLOAD give 2 bytes for each chinese character - I need fixed len which is not related to my problem.
    Below is my code:
    DATA: lv_codepage   TYPE cpcodepage,
            lv_char_cpage TYPE abap_encod,
            lv_encoding   TYPE abap_encod.
    Get Code Page for Chinese Character Spras = '1' or 'ZH'
      CALL FUNCTION 'NLS_GET_FRONTEND_CP'
        EXPORTING
          langu                 = '1'   " Chinese Simplified Table T002
          fetype                = 'MS'  " Manufacturer is Microsoft Table TCP05
        IMPORTING
          frontend_codepage     = lv_codepage
        EXCEPTIONS
          illegal_syst_codepage = 1
          no_frontend_cp_found  = 2
          internal_or_db_error  = 3
          OTHERS                = 4.
    Conversion c(4) = n(10)
      lv_char_cpage = lv_codepage.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'                       "tried ASC and not working as well
          codepage                = lv_char_cpage   "8404 in this case tried 8400 and same result
          replacement             = '#'
          write_field_separator   = 'X'
        TABLES
          data_tab                = i_data_cnvr        "table content
          fieldnames              = i_data_head      "table header
    Please help. Does this has something to do with utf-8 encoding?
    Thank you.
    Thanks,
    ZY See

    Hi Nitesh,
    Is there a way to check the Excel codepage? Do you mean by codepage = 936 for GB2312 encoding?
    Anyway, this issue is fixed. Issue is related to unicode system.
    Below codes for gui_download solved the problem.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
          codepage                = '4103'
          replacement             = '#'
          write_field_separator   = 'X'
          write_bom               = 'X'
        TABLES
          data_tab                = i_data_cnvr
          fieldnames              = i_data_head
    Codepage = 4103 for utf-16 Unicode system.
    Write-bom = 'X' to write Byte-Order-Mark.
    Thanks,
    ZY See

  • How to read text file contain chinese character ?

    Hi XI Expert,
    I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
    Please advise me how to maintaine the chinese character in PI 7.0 SP17.
    Thank You and Best Regards
    Fernand

    Hi,
    Refer these threads..
    Receiver file adapter corrupting characters
    Problem in converting special characters in input text file
    Here is one more useful guide..
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Regards,
    Sarvesh
    Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM

  • Chinese Character Support On MediaSource Organi

    Hi,
    I have MP3 song with filename in Chinese characters. On my Windows XP, I can view the filename in Chinese character using Windows File Explorer. Even the ID Tag also no problem. But when I use MediaSource Organizer, all my chinese character MP3 filename displayed as rubbish. Is there anyway I can make MediaSource to display chinese character without resorting to third party software since by nati've, Windows XP support chinese character viewing features.
    Thanks,Felix

    caniggia wrote:
    Hi guys. I'm using Win2000 version and it's diff. from XP.
    Anyone can help on this? Thks!
    You will need to install a language viewer. For example, to view Chinese/Korean/Janpanese, you can install NJ Star viewer.

  • Display Chinese Character jsp page  by using UTF-8

    hi all,
    I have one jsp page have Chinese character, need to allow user input Chinese character into db, right now my situation is if I set <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> , the Chinese character in my jsp page I can't display correcly, but the inser is okI have to set encoding to big5, then I can't insert chinese character into my db correctly.
    can I use UTF-8 to display my jsp page, which have Chinese Character in there?Thank you!

    Hi Niklas
    thank you for the suggestion. somebody told me UTF-8 suppose work, only if you typing your Chiness character in UTF-8 formate, i don't know that is true or not, but that realy a challenge for me, I using jdbc , some time ago, and then stop, and on that period,if I got free time, I did try to learn some tutorials on struct, hibernate, like http://javaboutique.internet.com/tutorials/Struts/; http://courses.coreservlets.com/Course-Materials/struts.html
    recently I need to deal with some online form , first I want to use struct, but I keep got forwad problem, I forget the detail error message, and found not place to ask questions, so , I pick jdbc again, so ,if you have some useful link in struct or a nice community for people to learn struct, I am look forward to
    know that,
    by the way I set *<meta http-equiv="Content-Type" content="text/html; charset=big5" /> in my jsp*
    String dbURL="jdbc:mysql://localhost/survey?useBig5=true&characterEncoding=Big5"; in jdbc
    keep UTF-8 setting in mysql, it looks solute the problem that I had, hope that can enhabce our knowledge in that
    thank you for the help and wish good luck for future.

  • Use dbms_lob.loadfromfile to handle chinese character

    Hello,
    I have a database with NLS_LANG=TRADITIONAL CHINESE_HONG KONG.ZHT16BIG5
    There is a table with clob type column.
    I've tried to use dbms_lob.loadfromfile to load file content into the clob type column.
    But the result is that no matter the file is english or chinese character, the column's content will become "monster".
    Is there any method to solve this problem ?
    Can anyone help ?
    Rgds,
    Edward
    null

    Hi, it's me again.
    I just want to share my experience and hope that it can help someone and someone can help me !
    I've created a database with UTF8 as my character set.
    With session's character set = UTF8, when I tried to use dbms_lob.loadfromfile to load data into clob column from a file with chinese character content. What has been stored is "monster" character. I know that it's because bfile is with binary type and will not do character set conversion when loadfromfile is being used.
    I've tried the other way, I use dbms_lob.read to read the file and use utl_raw to convert it to UTF8 character set and store it in a varchar2. It works !
    But what I want is to store the chinese character into the clob column.
    I've tried to use the following option but still fail :
    - convert (it's seems that has no effect)
    - utl_raw.translate (it always get oracle error, I've use this as : utl_raw.translate(RAW, 'UTF8', 'UTF8'))
    - utl_raw.convert
    Hope that some have experience can help me !
    Rgds,
    Edward
    null

  • Cant use chinese character in input scheduler name

    Cant use chinese character in input scheduler name

    Dear Sorin Radulescu 
    The input template name can't use chinese character,not the value in input schesule. I can save the template whih name english characters . if save it in chinese characters, I can't open it in input schedule.
    thanks

  • How to Export the chinese character in excel using java

    Hi,
    Our application using in English, German, Franch and chinese.
    String chineseCharacter=""; // chineseCharacter like &#38263;&#38271;&#29248;&#24202;&#26481;&#19996;&#24447;&#20315;. This chinese data coming from oracle database..
    My code
    BufferedWriter printer = new BufferedWriter(new OutputStreamWriter(responses.getOutputStream(),"utf-8"));
    responses.setContentType("application/download");
    responses.setHeader("Cache-Control", "cache");
    responses.setHeader("pragma", "cache");
    ExcelCSVPrinter outcr = new ExcelCSVPrinter(printer);
    String displayname="ChineseReport.csv";
    responses.setHeader("Content-Disposition","inline; filename=\"" + displayname + "\"");
    outcr.write("Report Header Name");
    outcr.writeln();
    outcr.write(chineseCharacter);
    outcr.writeln();
    After export the data to excel show the result for 長长牀床東东彿佛. But not show the original result &#38263;&#38271;&#29248;&#24202;&#26481;&#19996;&#24447;&#20315;
    I use the following stmt
    responses.setContentType("text/html charset=UTF-8");
    Its shows the correct result for chinese character.
    I use the below statement
    responses.setContentType("application/download; charset=UTF-8");
    or
    responses.setContentType("application/vnd.ms-excelset;charset=UTF-8");      
    or     
    responses.setContentType("application/vnd.ms-excel;charset=UTF-8");
    The out put show the in the excel sheet ???????? or some other jung characters.
    What can i do here?. After export,I want to show the original chinese character in the excel sheet using the ExcelCSVPrinter.
    Thanks & Regards
    Thendral
    Edited by: palanithendral on Dec 24, 2009 5:14 AM
    Edited by: palanithendral on Dec 29, 2009 11:41 AM

    palanithendral wrote:
    Hi,
    Our application using in English, German, Franch and chinese.You have several different idioms in your application and have not accurately identified where the actual problem is. You have all of the following
    -database
    -http
    -excel
    -excel in http
    -display on the target computer
    The first step with these sorts of problem is to identify where the problem actually occurs.
    String chineseCharacter=""; // chineseCharacter like &#38263;&#38271;&#29248;&#24202;&#26481;&#19996;&#24447;&#20315;. This chinese data coming from oracle database..A good theory. Now explain how you proved that that is what is coming from the database.
    After export the data to excel show the result for 長长牀床東东彿佛.As another example. Presumably you are referring to what the browser on the target computer displays. Your theory is that that computer and that browser (together) will display the correct information if they had the correct data. How did you prove that?

  • How can i convert jstring to PSTR with chinese character

    Hi all,
    I'm not an expert of C++. So please help me to fix the following problem.
    I'm using jni to call the dll. In java side, the input parameter is jstring. In C++ side, the input parameter of PrintDrugReceipt are PSTR.
    The following is the code of my C++:
    #include <windows.h>
    #include <stdio.h>
    #include <jni.h>
    #include "DrugReceiptWrapper.h"
    #include "DrugReceipt.h"
    const char * JNU_GetStringNativeChars(JNIEnv *env, jobject obj, jstring jstr) {
    jbyteArray bytes = 0;
    jthrowable exc;
         jclass cls;
         jmethodID getBytes;
    char *result = 0;
    if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
    return 0; /* out of memory error */
         cls = (*env)->GetObjectClass(env, obj);
         getBytes = (*env)->GetMethodID(env, cls, "getBytes","()[B");
         //jbyteArray buf = (jbyteArray*)(*env)->CallObjectMethod(env, obj, jlprSourceChiName, getBytes);
         bytes = (*env)->CallObjectMethod(env, jstr, getBytes);
         exc = (*env)->ExceptionOccurred(env);
         if (!exc) {
             jint len = (*env)->GetArrayLength(env, bytes);
             result = (char *)malloc(len + 1);
             if (result == 0) {
                 //JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0);
                 (*env)->DeleteLocalRef(env, bytes);
                 return 0;
    (*env)->GetByteArrayRegion(env, bytes, 0, len, (jbyte *)result);
    result[len] = 0; /* NULL-terminate */
    } else {
    (*env)->DeleteLocalRef(env, exc);
    (*env)->DeleteLocalRef(env, bytes);
    return result;
    JNIEXPORT jlong JNICALL
    Java_TestPrint_PrintDrugReceiptWrapper(
    JNIEnv *env, jobject obj,
    jstring jlprPrinterPort, jstring jlprSourceChiName,
    jstring jlprTargetChiName, jstring jlprPrintData1,
    jstring jlprPrintData2, jstring jlprCaseNo, jstring jlprReceiptNo){
         PSTR lprPrinterPort;
         PSTR lprSourceChiName;
         PSTR lprTargetChiName, lprPrintData1;
    PSTR lprPrintData2 , lprCaseNo, lprReceiptNo;
         printf("before %s", jlprSourceChiName);
         lprPrinterPort = (*env)->GetStringChars(env, jlprPrinterPort , 0);
         lprSourceChiName = (*env)->GetStringChars(env, jlprSourceChiName, 0);     
         lprTargetChiName = (*env)->GetStringChars(env, jlprTargetChiName, 0);
         lprPrintData1 = (*env)->GetStringChars(env, jlprPrintData1 , 0);
         lprPrintData2 = (*env)->GetStringChars(env, jlprPrintData2 , 0);
    lprCaseNo = (*env)->GetStringChars(env, jlprCaseNo , 0);
         lprReceiptNo = (*env)->GetStringChars(env, jlprReceiptNo , 0);
         PrintDrugReceipt(lprPrinterPort, lprSourceChiName, lprTargetChiName, lprPrintData1, lprPrintData2, lprCaseNo, lprReceiptNo);
         (*env)->ReleaseStringChars(env, jlprPrinterPort , lprPrinterPort);
         (*env)->ReleaseStringChars(env, jlprSourceChiName, lprSourceChiName);
         (*env)->ReleaseStringChars(env, jlprTargetChiName, lprTargetChiName);
         (*env)->ReleaseStringChars(env, jlprPrintData1 , lprPrintData1);
         (*env)->ReleaseStringChars(env, jlprPrintData2 , lprPrintData2);
         (*env)->ReleaseStringChars(env, jlprCaseNo , lprCaseNo);
         (*env)->ReleaseStringChars(env, jlprReceiptNo , lprReceiptNo);
         return 1;
    the h file:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class TestPrint */
    #ifndef _Included_TestPrint
    #define _Included_TestPrint
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: TestPrint
    * Method: PrintDrugReceipt
    * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
    JNIEXPORT jlong JNICALL Java_TestPrint_PrintDrugReceiptWrapper
    (JNIEnv *, jobject, jstring, jstring, jstring, jstring, jstring, jstring, jstring);
    #ifdef __cplusplus
    #endif
    #endif
    Note: the jstring input parameters are the chinese character. If i print out the jstring, it will display dirty character, why? and how to fix it? and the PrintDrugReceipt will expected accept the chinese character and print it to the printer.
    Thank you for you guys help.
    Matthew

    you can't use char...have to use a wchar....and look around at the wide character handling function in C/C++.

  • Problem with chinese character for dot matrix epson LQ-1600K III

    Hi All,
    I really runs out of idea about my problem now. The problem is about Print Chinese character to dot matrix printer (Epson LQ-1600K III). I tried to so many device type to solve this issue, looks like the only device type can be use are CNSAPWIN and CNEPSON with CNSONG font type. The others if I print to the printer, the chinese character became # (although in the print preview it`s okay and display correctly).
    Here is the bottleneck if I use CNEPSON:
    - if I have 2 window at the left and right position, if the left window has chinese character, the right window automatically shift right about 1.5 CM, which is damn weird!!! Can somebody help me
    - I tried so many ways to adjust the line size for my detail window (to cater positioning at pre-printed boxes), but looks the font size always become 10pt and line size cannot be adjustable (based on smartstyle).BUT if I used device type epescp2, it can be done!
    Here is the bottleneck if I use CNSAPWIN:
    - I need to create format type in windows and SAP (SPAD). and every PC that use this printer, must define the Paper size ( China Special paper size 12inch)
    - I also think this is not a good idea because as I far as I know this is not the correct way..
    Therefore, if somebody has experience about printer chinese character to dot matrix for Smartform and sapscript..please kindly help me give some advice.
    Do I use the wrong device type?
    Thanks in advance!
    Regards,
    Willy

    Hi friends , we are using the same model ....
    Are you using the chinese version operation system ? because we can print the chinese charaters without problem in LQ 1600KIII .....
    We are using CNSAPWIN device type + Frondend printing access method ....
    Carlos Zhang

  • Chinese Character Sets

    I'm setting up a web site, as a favor for a friend, that will
    be in Chinese and French. I'm not sure what the best page encoding
    would be. My friend sent me some sample Chinese, and she said, "The
    font I use is 'Simsun'." Otherwise, she is not very technical.
    There are apparently 4 character sets available in
    Dreamweaver that will display Chinese (after a fashion):
    1. charset=big5: displays in both code and design view, but
    Dreamweaver complains that not all characters can be displayed when
    I save the file, and some characters appear as "?" in both IE7 and
    Firefox. My friend says the characters don't look good.
    2. charset=gb2312: displays correctly in Dreamweaver and both
    of my browsers, and my friend says it looks OK.
    3. charset=hz-gb-2312: displays correctly in Dreamweaver code
    view, but not design view. Displays in both browsers I use, and my
    friend says it looks OK. This is apparently a 7 bit code that will
    encode both Chinese (as two byte characters) and ASCII. There is an
    escape character, "~" for toggling between the two sets. The HTML
    Dreamweaver creates seems to deal with this transparently.
    4. charset=utf-8: doesn't display in Dreamweaver (code or
    design view). Does seem to display correctly in my browsers, but my
    friend doesn't like it.
    I also noticed that although the characters displayed on my
    desktop system, I got all "?" on my laptop. Then it occurred to me
    that my friend had used my desktop to check her e-mail, so she had
    apparently installed the correct font(s). I displayed the pages in
    IE on my laptop, was prompted to install the fonts (Firefox didn't
    mention a problem), and then the text also displayed on my laptop.
    I intend to deal with this problem by creating any home page text
    (there won't be much) as Fireworks images. Anyone looking at the
    other Chinese text will undoubtedly have the correct fonts already.
    If any of you have done anything like this before, I would be
    grateful for any suggestions.

    Clean & Sober wrote:
    > 2. charset=gb2312: displays correctly in Dreamweaver and
    both of my browsers,
    > and my friend says it looks OK.
    GB2312 is the correct character set for Chinese as used in
    the People's
    Republic. It's sometimes known as "simplified Chinese". That
    doesn't
    mean it's simple, but that the characters have been
    modernized by
    removing some of the more complex strokes.
    To view pages written in Chinese or any other non-alphabetic
    script, you
    need to have the correct fonts installed. That shouldn't be a
    problem
    for the target audience.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • GUI_DOWNLOAD give 2 bytes for each chinese character - I need fixed length

    Due to the Unicode system takes each Chinese character as a byte, the field(10) can take 10 Chinese Characters, not like before only 5 characters allowed.
    The problem is when the data is downloaded to a txt file. Some records contains only Western Europe charactes and will fill 10 bytes in the output file and other records contains only Chinese characters and will fill up 20 bytes in the output file.
    The data is exported for a system that can upload chinese characters, but only allow fixed record length file (always 10 bytes).
    In other words: the records with Western Europe characters should contain 10 characters = 10 bytes but the records with Chinese characters should only contain 5 characters = 10 bytes.
    Anyone who can solve this, thanks in advance.
    My code:
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = p_file
          CONFIRM_OVERWRITE       = 'X'
          codepage                = '8400' "Chinese
        CHANGING
          DATA_TAB                = it_output
        EXCEPTIONS

    Hi Thomas,
    Now I understand.
    Pl. check the class CL_ABAP_CONV_X2X_CE.
    May it can help u.
    Here is it's documentation.
    CL CL_ABAP_CONV_X2X_CE
    Short Text
    Code Page and Endian Conversion Between External Formats
    Functionality
    Instances of the class CL_ABAP_CONV_X2X_CE allow you to convert text data between different character sets and numeric data between different number formats (byte order).
    Using the class corresponds to transforming data from a binary input stream to a binary output stream: The data objects are read from the input buffer sequentially and written to an output buffer.
    The class methods are normally used as follows:
    CL_ABAP_CONV_X2X_CE=>CREATE
    This creates a conversion instance. Among other options, you can specify the following as parameters: The input buffer (that is the binary string that contains the data to be read), the character format at used in the input buffer, the byte order used in the input buffer, the character format to be used in the output buffer, or the byte order to be used in the output buffer.
    CONVERT_C, CONVERT_...
    This converts the data. Calling this method several times consecutively allows you to read data from the input buffer sequentially and add it to the end of the output buffer.
    GET_OUT_BUFFER
    This gets the output buffer, making it available for further processing (such as writing to a file, sending using RFC).
    RESET
    This allows you to reset individual attributes of the conversion instance. (This method is especially designed for restarting on a new input buffer and deleting the output buffer while retaining the remaining attributes.)
    Relationships
    CL_ABAP_CONV_IN_CE
    Converting Binary Data into ABAP Data Objects
    CL_ABAP_CONV_OUT_CE
    Converting ABAP Data Objects to a  Binary Format.
    CL_ABAP_CHAR_UTILITIES
    Various Attributes and Methods for Character Sets and Byte Order
    Example
    In the following example, UTF-8 texts are converted to the codepage 1100 (Latin-1) and numbers are converted from little-endian to big-endian format:
    DATA:
      in_buffer TYPE XSTRING,
      out_buffer TYPE XSTRING,
      conv TYPE REF TO cl_abap_conv_x2x_ce.
    in_buffer = '414220C3B602010000'.
    conv = cl_abap_conv_x2x_ce=>create(
             in_encoding = 'UTF-8'
             in_endian = 'L'
             out_encoding = '1100'
             out_endian = 'B'
             input = in_buffer
    CALL METHOD conv->convert_c( n = 5 ).
    CALL METHOD conv->convert_i( ).
    out_buffer = conv->get_out_buffer( ).
    The content of the in_buffer variable is made up of  5 bytes (hexadecimal "414220C3B6"), which represent 4 UTF-8 characters (A, B, SPACE, o-Umlaut), and 4 bytes (hexadecimal "02010000"),  which represent the value 258 in little-endian format. This data is converted and the out_buffer variable now contains the hexadecimal string "414220F600000102". It is made up of:
    4 bytes (hexadecimal "414220F6"), which represent the above  4 characters in codepage 1100 (ISO-8859-1). Note that the length specification n = 5 refers to the number of elementary characters to be converted. For multi-byte codepages like UTF-8 this means that the multi-byte character "C3B6" is counted in length 2.
    4 Bytes (hexadecimal "00000102"), which represent the value 258 in big-endian format.
    If you have the desired byte order in the old format as expected by TRANSLATE ... NUMBER FORMAT (as an N(4) value), you can proceed as follows:
    TYPE-POOLS: ABAP.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    DATA:
      in_number_format(4) TYPE N VALUE '0101',
      out_number_format(4) TYPE N VALUE '0000'.
    DATA:
      in_endian TYPE ABAP_ENDIAN,
      out_endian TYPE ABAP_ENDIAN,
      conv TYPE REF TO cl_abap_conv_x2x_ce..
    in_endian  = cl_abap_char_utilities=>number_format_to_endian(
                   in_number_format
    out_endian = cl_abap_char_utilities=>number_format_to_endian(
                   out_number_format
    conv = cl_abap_conv_x2x_ce=>create(
             in_encoding = 'UTF-8'
             in_endian = in_endian
             out_encoding = '1100'
             out_endian = out_endian
             input = in_buffer
    Notes
    For details refer to the documentation for the individual methods.
    Regards,
    Joy.

  • How to put Chinese character in jar file by java.util.jar.Manifest?

    Now I want to develop a simple package tool which can modify some property in manifest.mf of jar files,but the Manifest class's putValue method only can correctly save English character.why?
    And how can I put Chinese character?
    the code is:
    Attributes ab = mf.getMainAttributes();
    ab.putValue("agent-Name", agent);

    Attribute values can contain any character and it will be UTF-8 encoded when written to the manifest, according to Javadoc.
    What makes you think that this mechanism fails? What do you see instead of the Chinese character? And what tool/editor/program you use to see it? I did not try myself, but according to the Javadoc there should be no problem.

Maybe you are looking for

  • Mastering plug-in or upgrade to Logic Studio?

    I'm currently trying out the oZone demo & like several of it's features-although some things about it are quirky. I'm wondering if I should spring for it-or something similar-or upgrade to full blown Logic. Anyone have experience with oZone or any ot

  • [solved] How to install the AUR

    I apologise if this question is answered somewhere, but I looked at the wiki pages and I am still confused. I am trying to install libreoffice-extension-languagetool I am using the command: sudo pacman -S libreoffice-extension-languagetool I get the

  • Toolbars in dreamweaver in random places on startup?

    I honestly don't know what i did.. but when i open dreamweaver my properties toolbar appears in the middle of the screen and my css toolbar is not visible - how do i  re-set toolbars?

  • RAID driver

    I just installed XP and the nvidia drivers, but each time Windows is starting, it is telling he found a new Hardware (RAID), and asking to install the drivers. I'm not using RAID feature on my system ... should I install the driver with the provided

  • Thai Text in FrameMaker 10

    I have a Frame Maker 8 file, that I opened in FM 10, and the Thai text is not rendered properly whether I use Angsana (New / UPC), Tahoma, Arial Unicode MS or DB Thai. This is what is look with Angsana (Some extra points are shown) http://www.flickr.