Japanese characters, outputstreamwriter, unicode to utf-8

Hello,
I have a problem with OutputStreamWriter's encoding of japanese characters into utf-8...if you have any ideas please let me know! This is what is going on:
static public String convert2UTF8(String iso2022Str) {
   String utf8Str = "";
   try {          
      //convert string to byte array stream
      ByteArrayInputStream is = new     ByteArrayInputStream(iso2022Str.getBytes());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      //decode iso2022Str byte stream with iso-2022-jp
      InputStreamReader in = new InputStreamReader(is, "ISO2022JP");
      //reencode to utf-8
      OutputStreamWriter out = new OutputStreamWriter(os, "UTF-8");
      //get each character c from the input stream (will be in unicode) and write to output stream
      int c;
      while((c=in.read())!=-1) out.write(c);
      out.flush();          
     //get the utf-8 encoded output byte stream as string
     utf8Str = os.toString();
      is.close();
      os.close();
      in.close();
      out.close();
   } catch (UnsupportedEncodingException e1) {
      return    e1.toString();
   } catch (IOException e2) {
      return e2.toString();
   return utf8Str;
}I am passing a string received from a database query to this function and the string it returns is saved in an xml file. Opening the xml file in my browser, some Japanese characters are converted but some, particularly hiragana characters come up as ???. For example:
屋台骨田家は時間目離れ拠り所那覇市矢田亜希子ナタハアサカラマ楢葉さマヤア
shows up as this:
屋�?�骨田家�?�時間目離れ拠り所那覇市矢田亜希�?ナタ�?アサカラマ楢葉�?�マヤア
(sorry that's absolute nonsense in Japanese but it was just an example)
To note:
- i am specifying the utf-8 encoding in my xml header
- my OS, browser, etc... everything is set to support japanese characters (to the best of my knowledge)
Also, I ran a test with a string, looking at its characters' hex values at several points and comparing them with iso-2022-jp, unicode, and utf-8 mapping tables. Basically:
- if I don't use this function at all...write the original iso-2022-jp string to an xml file...it IS iso-2022-jp
- I also looked at the hex values of "c" being read from the InputStreamReader here:
while((c=in.read())!=-1) out.write(c);and have verified (using character value mapping table) that in a problem string, all characters are still being properly converted from iso-2022-jp to unicode
- I checked another table (http://www.utf8-chartable.de/) for the unicode values received and all of them have valid mappings to a utf-8 value
So it appears that when characters are written to the OutputStreamWriter, not all characters can be mapped from Unicode to utf-8 even though their Unicode values are correct and there should be utf-8 equivalents. Instead they are converted to (hex value) EF BF BD 3F EF BF BD which from my understanding is utf-8 for "I don't know what to do with this one".
The characters that are not working - most hiragana (thought not all) and a few kanji characters. I have yet to find a pattern/relationship between the characters that cannot be converted.
If I am missing some....or someone has a clue....oh...and I am developing in Eclipse but really don't have a clue about it beyond setting up a project, editing it and hitting build/run. It is possible that I may have missed some needed configuration??
Thank you!!

It's worse than that, Rene; the OP is trying to create a UTF-8 encoded string from a (supposedly) iso-2022 encoded string. The whole method would be just an expensive no-op if it weren't for this line:   utf8Str = os.toString(); That converts the (apparently valid) UTF-8 encoded byte array to a string, using the system default encoding (which seems to be iso-2022-jp, BTW). Result: garbage.
@meggomyeggo, many people make this kind of mistake when they first start dealing with encodings and charset conversions. Until you gain a good understanding of these matters, a few rules of thumb will help steer you away from frustrating dead ends.
* Never do charset conversions within your application. Only do them when you're communicating with an external entity like a filesystem, a socket, etc. (i.e., when you create your InputStreamReaders and OutputStreamWriters).
* Forget that the String/byte[] conversion methods (new String(byte[]), getBytes(), etc.) exist. The same advice applies to the ByteArray[Input/Output]Stream classes.
* You don't need to know how Java strings are encoded. All you need to know is that they always use the same encoding, so phrases like "iso-2022-jp string" or "UTF-8 string" (or even "UTF-16 string") are meaningless and misleading. Streams and byte arrays have encodings, strings do not.
You will of course run into situations where one or more of these rules don't apply. Hopefully, by then you'll understand why they don't apply.

Similar Messages

  • Reading Japanese characters.

    I am not able to read Japanese characters in Unicode in Sun machines. Has any body experienced this problem before. I hade a Shift-SJIS encoding file. I later ran the native2ascii -encoding SJIS on the file and when I bring up my application. I do not see the Japanese characters at all.
    Thanks,

    I have a file in Shift-JIS. I then compile using javac -encoding SJIS to let the compiler know that it is a Shift-JIS file. I am not able to get it running in Solaris machine. Do I need to do something different for this. I have JapStrings_ja.java file which has the strings in Shift-SJIS.
    Thanks

  • Create HTML file that can display unicode (japanese) characters

    Hi,
    Product:           Java Web Application
    Operating system:     Windows NT/2000 server, Linux, FreeBSD
    Web Server:          IIS, Apache etc
    Application server:     Tomcat 3.2.4, JRun, WebLogic etc
    Database server:     MySQL 3.23.49, MS-SQL, Oracle etc
    Java Architecture:     JSP (presentation) + Java Bean (Business logic)
    Language:          English, Japanese, chinese, italian, arabic etc
    Through our java application we need to create HTML files that have to display unicode text. Our present works well with English and most of the european character set. But when we tried to create HTML files that will display unidoce text, say japanese, only ???? is getting displayed. Following is the code we have used. The out on the browser displays the japanese characters correctly. But the created file displays only ??? in place of japanese chars. Can anybody tell how can we do it?
    <%
    String s = request.getParameter( "txt1" );
    out.println("Orignial Text " + s);
    //for html output
    String f_str_content="";
    f_str_content = f_str_content +"<HTML><HEAD>";
    f_str_content = f_str_content +"<META content=\"text/html; charset=utf-8\" http-equiv=Content-Type></HEAD>";
    f_str_content = f_str_content +"<BODY> ";
    f_str_content = f_str_content +s;
    f_str_content = f_str_content +"</BODY></HTML>";
    f_str_content = new String(f_str_content.getBytes("8859_9"),"Shift_JIS");
    out.println("file = " + f_str_content);
              byte f_arr_c_buffer1[] = new byte[f_str_content.length()];
    f_str_content.getBytes(0,f_str_content.length(),f_arr_c_buffer1,0);
              f_arr_c_buffer1 = f_str_content.getBytes();
    FileOutputStream l_obj_fout; //file object
    //file object for html file
    File l_obj_f5 = new File("jap127.html");
    if(l_obj_f5.exists()) //for dir check
    l_obj_f5.delete();
    l_obj_f5.createNewFile();
    l_obj_fout = new FileOutputStream(l_obj_f5); //file output stream for writing
    for(int i = 0;i<f_arr_c_buffer1.length;i++ ) //for writing
    l_obj_fout.write(f_arr_c_buffer1);
    l_obj_fout.close();
    %>
    thanx.

    Try changing the charset attribute within the META tag from 'utf-8' to 'SHIFT_JIS' or 'utf-16'. One of those two ought to do the trick for you.
    Hope that helps,
    Martin Hughes

  • Handling Multi-byte/Unicode (Japanese) characters in Oracle Database

    Hello,
    How do I handle the Japanase characters with Oracle database?
    I have a Java application which retrieves some values from the database; makes some changes to these [ex: change value of status column, add comments to Varchar2 column, etc] and then performs an UPDATE back to the database.
    Everything works fine for the English. But NOT for Japanese language, which uses Multi-byte/Unicode characters. The Japanese characters are garbled after the performing the database UPDATE.
    I verified that Java by default uses UTF16 encoding. So there shouldn't be any problem with Java/JDBC.
    What do I need to change at #1- Oracle (Database) side or #2- at the OS (Linux) side?
    /* I tried changing the NLS_LANG value from OS and NLS_SESSION_PARAMETERS settings in Database and tried 'test' insert from SQL*plus. But SQL*Plus converts all Japanese characters to a question mark (?). So could not test it via SQL*plus on my XP (English) edition.
    Any help will be really appreciated.
    Thanks

    Hello Sergiusz,
    Here are the values before & after Update:
    --BEFORE update:
    select tar_sid, DUMP(col_name, 1016) from table_name where tar_sid in ('6997593.880');
    /* Output copied from SQL-Developer: */
    6997593.88 Typ=1 Len=144 CharacterSet=UTF8: 54,45,53,54,5f,41,42,53,54,52,41,43,54,e3,81,ab,e3,81,a6,4f,52,41,2d,30,31,34,32,32,e7,99,ba,e7,94,9f,29,a,4d,65,74,61,6c,69,6e,6b,20,e3,81,a7,e7,a2,ba,e8,aa,8d,e3,81,84,e3,81,9f,e3,81,97,e3,81,be,e3,81,97,e3,81,9f,e3,81,8c,e3,80,81,52,31,30,2e,32,2e,30,2e,34,20,a,e3,81,a7,e3,81,af,e4,bf,ae,e6,ad,a3,e6,b8,88,e3,81,bf,e3,81,ae,e4,ba,8b,e4,be,8b,e3,81,97,e3,81,8b,e7,a2,ba,e8,aa,8d,e3,81,a7,e3,81,8d,e3,81,be,e3,81,9b,e3,82,93,2a
    --AFTER Update:
    select tar_sid, DUMP(col_name, 1016) from table_name where tar_sid in ('6997593.880');
    /* Output copied from SQL-Developer: */
    6997593.88 Typ=1 Len=144 CharacterSet=UTF8: 54,45,53,54,5f,41,42,53,54,52,41,43,54,e3,81,ab,e3,81,a6,4f,52,41,2d,30,31,34,32,32,e7,99,ba,e7,94,9f,29,a,4d,45,54,41,4c,49,4e,4b,20,e3,81,a7,e7,a2,ba,e8,aa,8d,e3,81,84,e3,81,9f,e3,81,97,e3,81,be,e3,81,97,e3,81,9f,e3,81,8c,e3,80,81,52,31,30,2e,32,2e,30,2e,34,20,a,e3,81,a7,e3,81,af,e4,bf,ae,e6,ad,a3,e6,b8,88,e3,81,bf,e3,81,ae,e4,ba,8b,e4,be,8b,e3,81,97,e3,81,8b,e7,a2,ba,e8,aa,8d,e3,81,a7,e3,81,8d,e3,81,be,e3,81,9b,e3,82,93,2a
    So the values BEFORE & AFTER Update are the same!
    The problem is that sometimes, the Japanese data in VARCHAR2 (abstract) column gets corrupted. What could be the problem here? Any clues?

  • Unicode to Japanese characters

    Hi,
    I need a function to convert unicode to Japanese characters. I have a unicode string in my syncBO and it needs to be converted to the "strange" Japanese characters.
    When I read the unicode String from the MAMText files it is automatically done by the MI framework.
    Unicode string example: \u6A5F\u80FD\u5834\u6240\u4E00\u89A7
    Are there standard MI functions for me which are converting these kind of Strings? Because for the MAMText files it is working via the getString method of the com.sap.ip.me.api.services.MEResourceBundle class.
    I hope someone knows more about this conversion.
    Thanks in advance! Kind regards,
    Bart Elshout

    hi bart,
    it would be nice if you could feedback me with the error problems.
    i know the code might not cater to all of the requirements, you might need to add
    other escaped characters if you need to in the switch scope. i forgot to tell you
    that to use the a2n function you should provide it with the string in its ISO format.
    try running on the MyTest program below with the argument as follows:
    MyTest "u6A5Fu80FD u5834 u6240u4E00u89A7"
    public class MyTest {
      public  static void main(String[] args){
        System.out.println(a2n(args[0]));
    if you use it like this way, it will not work, since the String class will detect this
    and automatically create the native representation of the characters. there's no
    need for the a2n function.
      String s = "u6A5Fu80FD u5834 u6240u4E00u89A7";
      System.out.println(a2n(s));
    if you are reading text from an ascii file, you need to specify that the input stream
    should be  ISO-8859-1 i.e.something like
    new InputStreamReader(inStream, "ISO-8859-1")
    hope this helps.
    jo

  • Sql Plus and Unicode (or utf-8) characters.

    Hello,
    i have problem with Sql Plus and unicode files. I want to execute Start {filename}, where {filename} is file in unicode format (this file have to contains german and polish characters). But i receive error message. It is possible to read from unicode (or utf-8) file and execute commands from this file)?
    Thanks in advance.
    Pawel Przybyla

    What is your client operating system characterset?

  • Passing Japanese characters to Java program

    Hi,
    I am using Java POI APIs for creating/modifying excel spreadsheets. The platform is Solaris. The data to be populated contains both English as well as Japanese characters. The input data to Java program comes from a perl program. When I populate the data in excel or even print using System.out.println, it prints ???... for Japanese characters. The data is in SJIS format.
    I tried converting it to UNICODE in java but that doesn't seem to be working.
    I also tried using native2ascii for converting the data to UNICODE before it is fed to Java program using the following command
    native2ascii -encoding SJIS <Input File> <Output File>
    Although it converts the charaters into UNICODE correctly in the form \u8a3c\u523... but when it is input to Java, the program prints the string as such.
    But if this string is hardcoded in the program, the Japanese characters are printed correctly.
    Could anybody please throw some light as to the data should actually be passed to the Java program.
    Thanks

    Sekhar
    Ive realised the solution will probably involve HttpServletRequest.setCharacterEncoding.
    Im now upgrading to Tomcat 4 because 3 didnt support this method. Once I'm through the upgrade, I'll try Japanese the chars again.
    I would guess I need to force my web pages to utf-8 and use HttpServletRequest.setCharacterEncoding(utf-8) in the servlet to get it working ?

  • Japanese characters in left pane

    I have a project that has been translated into Japanese, and
    the left pane of my FlashHelp system does not render the characters
    correctly. The funny thing is that I got it to work in another
    project that was translated, one that I think was built in X5 (or
    possibly earlier) and has a skin that RoboHelp says should be
    updated when I generate the output. I don't dare change it now, and
    it seems to work fine.
    Unfortunately, I didn't make a record of exactly how I got
    that to work
    , but I seem to remember it had to do with embedding
    Japanese characters in the Flash skin files. Fonts are also
    declared in the skin .fhs file and the accompanying XML file, and
    I'm not sure how they interact, but it seems that the fonts in the
    Flash files supercede those in the skin file.
    In my newer project, the toolbar buttons show up in Japanese,
    as do the "terms" and "definitions" headings in the glossary and
    the index keyword prompt. It's the TOC entries, glossary terms, and
    index terms that have the problem, and they are all driven by the
    file skin_textnode.swf. As long as the other files are set to Arial
    or Arial Unicode MS in Flash, they display Japanese correctly, even
    if Japanese isn't embedded (using "anti-alias for animation").
    Without Japanese embedded in skin_textnode.fla, I get this kind of
    nonsense in the left pane:
    検索する.
    But with Japanese embedded, I get symbols like paragraph symbols,
    plus-or-minus signs, and daggers. I have also saved the .hhc file
    (the TOC) and the .hhk (index) in UTF-8 format using Notepad, but
    no change there. The junk characters also show up in the overlaying
    window when clicking a term in the index, and that's driven by
    skin_index.fla. I've tried the font and character embedding with
    that file. I have tried changing "font-family:Arial" in the skin
    file to both "font:"Arial Unicode MS"" and "font:"Arial"". No
    difference.
    I have compared files with that earlier project. As far as I
    can tell, I have done things comparably, but the junk characters
    persist in the left pane. It doesn't appear that there are
    substantial differences between the way the old and new skins are
    executed to cause the Japanese to work in one and not the other.
    Any ideas that may help me make this work again? I'm using RoboHelp
    6, Windows XP SP2, IE 6. (In theory, making this work for Japanese
    will also solve my problem for Russian. I'm hoping the language
    capabilities of RH7 handle all of this better so I don't have to
    use these work-arounds for non-Roman characters.)
    I know this is a load of information, but I've tried to
    describe the circumstances adequately without writing the great
    American novel. I'll clarify anything that's needed. Thanks,
    Ben

    Solved: I found once more that the TOC, glossary, and index
    information is pulled from files in the whxdata folder:
    whtdata...xml, whgdata...xml, and whidata...xml, respectively,
    which are all in UTF-8 format. The Japanese characters have to be
    changed in these files, but they get overwritten during a build, so
    they have to be stored with the correct characters in another
    location. Fortunately, our glossary will probably not be changing,
    but the TOC and index will grow as the project moves forward, so
    this will take some babysitting.
    This all leads me to wonder why RoboHelp generates copies of
    the .glo, .hhk, and .hhc files into the output folder when it's the
    XML files that are used instead...

  • How to upload file containing Japanese characters in AL11

    Hi All,
    I'm trying to modify a program that extracts a text file from local drive then upload the file to sap directory. The input text file contains Japanese characters. When I view the file created, it looks like the one below:
    #º#®#~#^#ì#q  ¼ÓÔ¼·Ï·º
    #ì#ç#ß#q  ÐÅÐÁÂÞº
    The code that I am fixing is below:
       open dataset pv_name for output in text mode encoding non-unicode
       ignoring conversion errors.
    open dataset pv_name for output in legacy text mode code page '8000' ignoring conversion errors.
    *OPEN DATASET pv_name FOR OUTPUT IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK.
        if sy-subrc = 0.
        LOOP AT pt_input.
          TRANSFER pt_input TO pv_name.
          IF SY-SUBRC NE 0.
            WRITE:/ 'Error writing file'(011), pv_name.
            STOP.
          ENDIF.
        ENDLOOP.
       endif.
      Close dataset
        CLOSE DATASET pv_name.
    Any suggestions on how to resolve this one?
    Thanks a lot in advance.

    I didnt said that this will resolve your errors. But using this is the same of ignoring comiler errors....
    As you didnt said anything about codepages you're using no help is possible, you didnt mentioned if your SAP system is Unicode, Non-Unicode or even a MDMP system.
    You need to figure out which codepage the file has on the presentation server and which codepage your SAP system is using. And it can be that no conversion is possible cause both systems do not have any character in common.

  • Japanese characters retrieved from UTF8 d/b from excel

    Hi All,
    I am generating a csv file(comma seperated) through a query from Oracle 9i database. There is one field which is Japanese. Our database is UTF8 enabled and when the csv file is opened from notepad/textpad then it is showing the Japanese characters properly but when we are opening the file from excel(which is our requirement) then the data is not coming properly.
    I am copying the data below directly from the excel sheet. CLIENT_NAME_LOCAL(NVARCHAR2 field) is the field which captures japanese. It can be seen that the data for the FUND_CODE=811018 is correctly coming but for 809985 it is seen that the CLIENT_NAME_LOCAL and FUND_CODE columns are getting concatenated with a &#12539; sign in the middle and so in the FUND_CODE column the FROM_DATE value is coming, though the delimition ',' can be seen between the two fields when I'm opening the file from notepad. It is to be noted that I've used the CONVERT function in my query after this to change the CLIENT_NAME_LOCAL column to 'JA16SJIS' characterset but nothing got changed.
    N.B- I've copy and paste the data from excel so in the html format it seems that the FUND_CODE and FROM_DATE values are on the same vertical line but it is not so.
    ==========================================================
    TYPE CLIENT_NAME_LOCAL FUND_CODE FROM_DATE
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35674;&#65393;&#39501;&#65382;&#36881;&#65382;&#35649;&#65391;&#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406; 811018 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    AN &#35692;&#65386;&#34833;&#19976;&#65404;&#22786;&#65380;&#65406;&#32306;€&#34656;&#12539;&#39156;&#33651;&#25105;&#65402;&#12539;809985 01/09/2005
    Data in notpad
    ====================
    =======================================================
    TYPE,CLIENT_NAME_LOCAL,FUND_CODE,FROM_DATE,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26481;&#37030;&#29926;&#26031;&#26666;&#24335;&#20250;&#31038;,811018,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    AN,&#26666;&#24335;&#20250;&#31038;&#12288;&#21830;&#33337;&#19977;&#20117;,809985,01/09/2005,
    Thanks & Regards,
    Sudipta

    You can open UTF-8 files in excel:
    1. change file extension to .txt
    2. in excel: Open/File -> point to your file
    3. excel opens file convert dialog, in "file origin" field choose: "65001:Unicode (UTF-8)"
    4. proceed with other setting - You got it!
    This procedure work for sure in Excel 2003
    Regards
    Pawel

  • Java PrintService printing Chinese/Japanese characters output is garbled.

    Hi Java Gurus,
    I have been spending the whole day trying to make our text printing application able to print non-western Characters (e.g. Chinese and Japanese) as part of our requirements. But I am constantly getting garbled output when I print a UTF-8 formatted text file containing Chinese characters. I've been trying to switch the DocFlavor types (e.g. byte array in UTF 8, input stream auto sense, UT8-8, etc) but I couldn't simply make it work.
    Here is our test method:
         public void testPrintText(String fileName) throws Exception {
              FileInputStream textStream = new FileInputStream(fileName);
              File file = new File(fileName);
              String fileContent = FileUtils.readFileToString(file);
              DocFlavor flavor = DocFlavor.BYTE_ARRAY.TEXT_PLAIN_UTF_8;
              //DocFlavor flavor = DocFlavor.READER.TEXT_PLAIN;
              InputStreamReader isr = new InputStreamReader(textStream, "utf-8");
              DocAttributeSet das = new HashDocAttributeSet();
              //System.out.println("host encoding: " + flavor.hostEncoding);
              Doc mydoc = new SimpleDoc(fileContent.getBytes("utf-8"), flavor, das);
              //Doc mydoc = new SimpleDoc(textStream, flavor, das);
              PrintRequestAttributeSet pas = new HashPrintRequestAttributeSet();
              pas.add(new PrinterName("\\\\fsinec\\Canon iR5055 PCL6", null));
              PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, pas);
              PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
              System.out.println("DEBUG: " + defaultService.getClass().getName());
              if(services.length == 0) {       
                   if(defaultService == null) {
                        //no printer found
                   } else {            
                        //print using default
                        DocPrintJob job = defaultService.createPrintJob();
                        job.print(mydoc, pas);
              } else {        
                   //built in UI for printing you may not use this
                   PrintRequestAttributeSet attSet = new HashPrintRequestAttributeSet();
                   for(int ctr=0; ctr<services.length; ctr++) {
                        PrintService printService = services[ctr];
                        System.out.println("COTS DEBUG: " + defaultService.getClass().getName());
                   //attSet.add();
                   PrintService service = null;
                   if(services.length == 1) {
                        //assume that there is no other printer with the name \\\\fsinec\\Canon iR5055 PCL6
                        //resulting to fetch the printer services to only one (1) element.
                        service = services[0];
                   /* open a dialog box
                   * PrintService service =
                        ServiceUI.printDialog(null, 200, 200, services, defaultService, flavor, attSet);*/
                   if (service != null) {           
                        DocPrintJob job = service.createPrintJob();
                        job.print(mydoc, attSet);
    Please help me on this.
    Thanks.

    This could be of different reeasons...
    1) Make sure your printer is uni-code enabled.
    2) Make sure, your unicode enabled printer is configured in SAP.
    3) make sure, your printer device is supported by SAP. (You can find list of SAP recommended printers in www.service.sap.com)
    4) Check whether the correct device type is used for printing chinese and japanese characters.
    5) Check code pages.
    6) Make sure you use Cyrillic font family, for printing chinese and Japanese characters.
    Regards,
    SaiRam

  • Do we need to convert Chinese/Japanese properties to Unicode?

    Dear friends,
    I am new to this Internationalization concept. I have a web application and I am looking forward to implement Internationalization.
    To make my app support muti-language, I am using Locale & Resource bundle to find properties files based on Country and Language. I have different properties files based on countries. This works fine when there are unicode characters and no special characters in the property file.
    For eg. the application doesn't displays Chinese/Japanese characters with System.out.println at all. It displays something weird symbols..
    P.S : I haven't converted Chinese/Japanese properties files to Unicode with native2ascii tool?
    An important question for me is,
    1) Do we need to convert Chinese/Japanese or any non-unicode related properties files with native2ascii tool?
    2) Is there any other way to read such properties files without converting them with native2ascii tool?
    3) We have made fixed UTF-8 format policy for the app. Is there any way to read those properties file with UTF-8 mechanism without need to convert the properties files?
    4) If anyone has quick example code for displaying Chinese/Japanese characters from properties file, then that would be a great help.
    Thanks a million. Any help would be highly appreciated.
    sachin

    System.out.println display depends on the system locale. If you are running on a US English system, Chinese and japanese will not display correctly in the console.
    Your properties file questions:
    1) Do we need to convert Chinese/Japanese or any non-unicode related properties files with native2ascii tool? yes
    2) Is there any other way to read such properties files without converting them with native2ascii tool? - no
    3) We have made fixed UTF-8 format policy for the app. Is there any way to read those properties file with UTF-8 mechanism without need to convert the properties files? no

  • Display Japanese characters on Applet

    Hi All,
    I am able to display Japanese Characters on my Applet locally(Windows 2000 - US) by overwriting the font.properties content with the one in font.properties.ja found in JRE/LIB directory of my Jdeveloper JDK. When I deploy the applet on 9ias server which is configured for UTF8 charset I get squares wherever I have Japanese characters.
    Appreciate if someone could tell the procedures to make the applet to recognize the Japanese/UTF8 characters and display accordingly.

    I have read some documentation on JDBC thin drivers and they have mentioned that whenever JDBC retreives data from a database it converts it to Unicode 1.2 and I am already retreiving data from a UTF 8 database. The reason I think this is true is because I can display japanese characters locally on my windows machine by overwriting the font.properties in the JDevelopers- JDK- JRE - LIB folder by font.properties.ja
    There must be some way to test why it is showing squares for japanese characters when I deploy it on the server. May be not getting the MS Gothic font used to display Japanese?
    Looks like updating all the code is not feasible at this point as the code currently stores the data in Vectors and we can't perform a vector.getBytes(). Any help will be really appreciated.

  • Write Japanese characters to CSV

    In my JSP I am doing the following
    <head>
          <script type="text/javascript">
          var newWindow;
          function checkForCSVExport()
                <% 
                      String results = (String) session.getAttribute("EXCEL_FB_DATA") ;
                      String URL = (String) Form.makeUrl(request,"/custom/jsp/search/load_csv.jsp");
                      if(null != results)
                            out.println(
                                        "newWindow=window.open(\""
                                        + URL
                                        + "\", \"export\", \"toolbar=no,menubar=no,width=200,height=200,resizable=no\");");
                %>
    </script>
    </head>the String results contain comma seperated values with Japanese characters in them. We need to write these Japanese characters to CSV. For this we have a JSP page called load_csv.jsp. Here are its contents
    <%@ page contentType="application/csv; charset=UTF-8" %>
    <%@ page import="com.components.search.SearchResultsFeedback"%>
    <%
          String strFBResults = (String)session.getAttribute("EXCEL_FB_DATA");
          String strFBHdr = (String)session.getAttribute("EXCEL_FB_HEADER");
          response.setHeader("Content-Disposition", "attachment;filename=searchresult.csv");
    %>
    <%=strFBHdr%>
    <%=strFBResults%>this works fine for English characters but Japanese characters are displayed as junk characters in CSV. Please help.

    Thanks for replying. I am using UTF-8 throughout.
    Also, there is an interesting thing that I observed. If I right click on the CSV file and select "Open with --> Word" then the word application asks me
    "Select the encoding that makes your document readable". If I select "Unicode (UTF-8)", Japanese characters appear perfectly fine. But why doesn't this happen in excel as that is also UTF-8 compliant since I can type japanese characters into the same excel file.

  • Japanese Characters in XI

    Hi All,
    I am working on a XML to IDOC scenario where data contains Japanese characters. 
    The input file is:
    <? xml version="1.0" encoding="UTF-8" ?>
    - <ns0:f2i_send_mt xmlns:ns0="urn://file2idoc">
      <matnr>0000000012</matnr>
      <mbrsh>iron</mbrsh>
      <mtart>k</mtart>
      <msgfn>&#20808;&#20633;&#32771;</msgfn>
      </ns0:f2i_send_mt
    I am able to see the input and output message in sxmb_moni with the japanese characters. The scenario is successful. But the problem is that the output in the R/3 system is seen as a junk.(Something like this ####)
    What could be the possible reason for this?
    Is it a problem with the scenario or is it that the R/3 systems needs some support package of Japanese??

    Hi kartik !!!
    This will help you
    http://unicode.org/unicode/faq/utf_bom.html#3
    http://mail-archives.apache.org/mod_mbox/xerces-j-users/200306.mbox/%3C8F7E4BBE4270D511BE550002A5751A3901DA5A90@GBTPM201%3E
    I
    UTF-8 is capable of doing this.
    For this see this
    http://www.geocities.com/dtmcbride/tech/charsets/chinese.html
    >>Also does the input file read format should be changed to binary instead of TEXT
    It shd be text when u want to specify a encoding.
    Pls reward if useful

Maybe you are looking for

  • Won't display ANY of my music

    Okay, so my mini works fine one day and ***** the next. When I scroll in my Music, it does not list any artists, albums, songs, etc. It seems as if it erased everything. So, I go to my settings and go to the about column, it lists that I still have 1

  • Need your expertise in abdobe flex development

    hi exprts, i am an ABAP developer with fair knowledge in ABAP webdynpro. I am trying to learn integrating adobe flex component into webdynpro. i went through the SDN blogs by thomas jung and created one application as well, which is working fine. Now

  • WinProducer2 start error, won't run with nVidia Capture drivers

    I'm not having a good experience with the bundled WinProducer2 that came with my MX440VT8x-128. If I have either of the versions of the nVidia capture-drivers that came on the card's CD (that's v. 1.16 or 1.18)  installed, or the 1.22 version from nV

  • TS3989 icloud back up stopped in progress now wont open

    I was backing up mu 3gs on icloud and have had NO issues or problems since I purchased it! I moved and Ive been without wifi for a few weeks but after connecting, backing up, working great as always but it just stopped...wifi may have dropped?? Now i

  • Animatics dll calls

    I've created Serial labview drivers that communicate with Animatics motors (via RS-232) but was wondering if anyone's created a labview program that is based on their SMI engine (SMIengine.dll) using Call Library Functions? This would allow more flex