How to display Chinese language?

There is a plan text file: article.txt, this file includes an Chinese article (Chinese Language).
The web server is English system.
Now I use a jsp file to display the content of this file, I use BufferedReader class to read the content of the file, then display it.
I use contentType="text/html;charset=gb2312" also, but it cannot display Chinese Character correctly.
Can anyone tell me how to display it?

Hi i am having the same problem....how did you do it...can please help me
<pre>
<%@ page import="java.util.*,java.io.*,java.text.*,java.sql.* " %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<% response.setContentType("text/html; charset=UTF-8"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>
</title>     
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     
<meta name="Generator" content="TextPad 4.0" />
<meta name="Author" content="" />     
<meta name="Keywords" content="" />     
<meta name="Description" content="" />
</head>
<body bgcolor="#ffffff" background="" text="#000000" link="#ff0000" vlink="#800000" alink="#ff00ff">
<%
request.setCharacterEncoding("UTF-8");
String str1 = "\u7528\u6237\u540d";
String name = request.getParameter("name");
if(name != null) {     
// instead of setCharacterEncoding...     
name = new String(name.getBytes("ISO8859_1"), "UTF-8");
System.out.println(application.getRealPath("/"));
System.out.println(application.getRealPath("/src"));
%>
req enc: <%= request.getCharacterEncoding() %>
rsp enc: <%= response.getCharacterEncoding() %>
str1: <%= str1 %>
name: <%= name %>
<%
BufferedReader in = null;
ArrayList str = new ArrayList(100);
try {  
     in = new BufferedReader(new InputStreamReader( new FileInputStream("c:/Chinadescription\\coldtofu.txt"),"UTF-8"));
     String line;
     while ((line = in.readLine()) != null) {   
     line = line.trim(); //
     if (line.equals("[stop]"))
     break;
     str.add(line);
     finally {
     if (in != null) {  
     try {    
     in.close();
     catch (Exception e) {}
     for (int i = 0 ; i < str.size(); i++) out.println(str.get(i));
%>
<form method="GET" action="testcharacter.jsp" encoding="UTF-8">
Name: <input type="text" name="name" value="" >
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
</pre>

Similar Messages

  • How to display Chinese in AWT (Urgent!)

    I have to problems,
    My computer is Win2K Traditional Chinese
    I try to run an application which Display chinese characters on the component of AWT. Although the application can run and can display correctly, there are exceptions. It throws the following error continuously,
    sun.io.UnknownCharacterException
    sun.io.UnknownCharacterException
    at sun.io.CharToByteISO8859_1.convert(Unknown Source)
    at sun.awt.PlatformFont.makeConvertedMultiFontChars(Unknown Source)
    at sun.awt.PlatformFont.makeConvertedMultiFontString(Unknown Source)
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    sun.io.UnknownCharacterException
    sun.io.UnknownCharacterException
    at sun.io.CharToByteISO8859_1.convert(Unknown Source)
    at sun.awt.PlatformFont.makeConvertedMultiFontChars(Unknown Source)
    at sun.awt.PlatformFont.makeConvertedMultiFontString(Unknown Source)
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    I try to encodes the string as follow, however, it throws another exception
    String x = new String("ChineseWordHere".getBytes("ISO-8859-1"), "Big5");
    It throws exception:
    java.io.UnsupportedEncodingException: Big-5
    at sun.io.Converters.getConverterClass(Unknown Source)
    at sun.io.Converters.newConverter(Unknown Source)
    at sun.io.ByteToCharConverter.getConverter(Unknown Source)
    at java.lang.String.getBTCConverter(Unknown Source)
    at java.lang.String.<init>(Unknown Source)
    at java.lang.String.<init>(Unknown Source)
    at Test1.<init>(Test1.java:8)
    at Test1.main(Test1.java:13)
    Do you know how to solve these two problems??
    (The most concern is that how to display Chinese in AWT)
    Thanks

    For starters, you shouldn't use the 8859 encoding since it only supports single byte representations. You should be able to successfully use UTF-8. Then to actually display the characters...or to type them, make sure you have an input method editor (IME) that supports the language - in theory if you are using a Chinese Win2k, you already have this with windows - just use the right font (I think MS Gothic should work) to show the characters. You might want to consider switching to Swing.
    Good luck

  • HT201301 how about the Chinese language doc. Able to use with the My Lyric Book program?

    how about the Chinese language doc. Able to use with the My Lyric Book program?

    I'm not sure where you see that the links I gave suggested that. The iPhoto link (quoted below) in step 4 suggests dragging the library to the new location. You can do that in Finder by dragging the library to the external disk in the Finder sidebar. If you don't have a sidebar in Finder, go to the Finder View menu and click Show Sidebar. If the external disk isn't visible in the sidebar, go to the Finder Preferences, click Sidebar at the top of the Preferences window, and put a checkmark in front of External disks in the Devices section.
    You can move your entire iPhoto library to a different computer, a hard disk, or another location on your computer.
    Important:    Before you move your iPhoto library, it’s a good idea to back it up to a DVD or external hard disk.
    Move your iPhoto library
    If you’ve created multiple photo libraries, be sure to move only the library currently displayed when iPhoto is open. To move a different library, you first need to switch to it.
    Quit iPhoto.
    In the Finder, choose your home folder (it’s usually named after you).
    Open the Pictures folder (in the home folder) to locate the iPhoto Library file.
    Drag the iPhoto Library file to a new location on your computer.
    Open iPhoto.
    In the window that appears, select the library you want, and then click Choose.

  • How to display chinese on Nokia Xpress 5300?

    How to display chinese on Nokia Xpress 5300? I have chinese and english songs together in my phone. but the phone cannot display chinese characters. Any solutions?

    Sorry, my English is very pool.
    1.My source code is edit on windows98SE/Chinese.
    2.After compiler, My program can display Chinese on windows.
    3.When change os to linux and use KDE, I can see Chinese in source.
    4.If not create the "font.***.zh_TW" into /usr/.../lib,
    AWT/SWING component can't display chinese.
    5.If create the "font.***.zh_TW" into /usr/..../lib,
    the AWT component can display chinese and SWING component can't.
    6."LC_TYPE" is "zh_TW.Big5" and "LANG"="zh_TW.Big5".
    7.If re-complier in linux, The SWING component can't display chinese.
    8.When running, The system will display message
    "Warning:Cannot covert string "-default-ming-medium-r-normal
    -140---c-- big5-0".
    9.use command "xlsfonts | grep big5" can find font "-default-ming-...-big5-0".
    10.Check the "file.encoding" is "BIG5".

  • How to display Chinese characters in Oracle?

    I am using Oracle 8i with Language settings as AMERICA.
    I am displaying records which is contain Chinese characters.
    But it is not displayed properly in Oralce.
    How to change the settings to display Chinese characters?
    Thanks

    It could be possible to display Chinese characters using SQL Developer without any specific NLS_LANG setting because SQL Developer is using JDBC which doesn't use NLS_LANG setting according to When is NLS_LANG used ?.
    For example, I'm able to display the following Chinese character in SQL Developer 1.2.0 on Windows XP Pro with French Windows setting and NLS_LANG set in Windows registry to FRENCH_FRANCE.WE8ISO8859P1.
    select unistr('\8349') from dual;

    [pre]
    Message was edited by:
            Pierre  Forstmann                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why my os cant display chinese language file name

    when i download mp3 files in chinese language it wont display the character it will just show up with different weird character i use the newes os how do fix this

    Try with:
    NLS_LANG=AMERICAN_AMERICA.AL16UTF16Edited by: AP on Aug 25, 2010 3:13 AM

  • How to display the 'language code' for language dependent 'Short text' ?

    Hi,
    I am new to BW.
    Can somebody help me with the following issue?
    I have an attribute 'Material category description'  and I chose short text exists and made it language dependent. I had loaded the master data successfully.
    Now I want to know how to check the 'language code' for this material category description. When I display the data, will the language code display by defalult?
    I had checked the text table using SE11
    It displays the following fields over there.
    /BIC/TS1_MCT_DS   [  /BIC/TS1(InfoObject name)  ]
    LANGU
    TXTSH
    I appreciate your help!
    Thank you
    Sekhar

    Dinesh,
    I went to RSD1 -> info-object -> Master Data/text tab. It shows my language selections there (Short text selected, language time dependent etc.) with everything grayed out.
    In SE16, I could display the data in the following format.
    /BIC/ST_PRID                TXTSH                 TXTMD
    P01                                   umbrella                 rainyday
    P02                                  tent                         waterproof
    etc.
    I want to see the 'language code' as one of the columns in this table.
    Can you help me do that?
    Thank you,
    Sekhar

  • MAC Users: how to get Chinese language input for my Bold 9700

    Hey everyone, I have a Bold 9700 from AT&T and I need to get Chinese input to work.  But all of your solutions are for PC users, and I have a Mac.  I am using the latest desk top manager.  I can get read Chinese but can't input.  there is no option for Chinese input in the application loader.  HELP!  Thanks

    Same here,
    I have a bold 9700 with t mobile USA and a macbook pro
    how can i install chinese language input? HELP !!!
    (apparently it has to do with the desktop manager, no? but the mac version is very basic)
    thanks for the help !

  • How to display Chinese Charakters

    How can I display chinese Charakters in a efficient way
    Thanks

    AGHHH!!! Damn you java forum and damn your eyes. (i's)
    Assuming you mean in java?
    I did a program some time back that used a String array
    eg
    String []str ={"h","h#","?","?","?&","H","l","l#","l!","l@","L","/","/#","/!","/@","?",
    "m","m#","M","s","s#","s!","s@","S","r","r#","R","v","v#","v!","v@","V",
    "q","q#","q!","'","q@","Q","b","b#","b!","b@","B","t","t#","t!","?","t@","T",
    "c","c#","c$","c!","c@","C","~","~#","~!","`","~@","^","n","n#","n!","n@!","N",
    "x","x#","x!","x@","X","?","k","k#","k!","k@","K",",",",#",",!",",@","<",
    "w","w#","W",";",";#",":","z","z#","z!","z@","Z","y","Y",
    "d","d#","d!","d@","D","j","j#","j!","j@","J","g","g#","g!","U","g@","G",
    "-","-#","-!","-@","_","=","=#","=!","=@","u","[","[#","[!","[@","{","e","]","]#","]!",
    "}","f","f@","F","p","p#","p!","p@","P"};
    and the program was tuned to a
    xxx.setFont("otherScript",0,12);
    which was loaded onto the system
    The array can then be used to manipulate the output in a number of ways. In this case there was a keyboard of a button array eg;-
    for (int j=0; j<=str.length -1; j++){
         b[j]= new JButton(str[j]);
         b[j].setActionCommand(str[j]);
         b[j].setFont(f);
         panel.add(b[j]);
         b[j].setForeground(new java.awt.Color(255,20,45));
         b[j].setBackground(new java.awt.Color(20,40,150));
         b[j].addActionListener(this);
    // so with actionPerformed(ActionEvent evt){ // we have;-
    if(evt.getSource() instanceof JButton ){
        tansltnString += evt.getActionCommand();
    Also the str[int] value could be translated by other keys. Hope that helps.
    Sue x

  • How to display Chinese on BB8900?

    I have a BB8900 Curve with AT&T.  I want to be able to display chinese character on my BB.  Does anyone know how to do that?  Thanks

    There is advice in the link below that may be useful
    http://tinyurl.com/yatket9
    Blackberry Best Advice - Back-up weekly
    If I have helped you please check the "Kudos" star on the right >>>>

  • How to install chinese language in sap ecc 6.0 unicode system

    Hi,
        I want to install chinese language in my sap ecc 6.0 unicode system,where i would get chinese language in maraketplace.
    guide me for the same where i have to get chinese language,how to install in sap.
    Thanku

    Hello,
    There must be already some value in zcsa/installed_languages in your instance profile.
    Now in SMLT check the language information for checking the relevant value for chinese language and add this value to the parameter : zcsa/installed_languages
    Regards,
    Siddhesh

  • ASK : How to install Chinese language to my Curve 9300

    i use curve 9300, and i there is no chinese language, korean, or japanese, i readed more than ten threads which are discussing the problem, many of them said use the blackberry desktop software, but when i try, there no such option like adding language to device, i've download a lot of desktop software, but different version, but when i open it, i just the same, hope someone know how to help me ..

    Hello,
    There must be already some value in zcsa/installed_languages in your instance profile.
    Now in SMLT check the language information for checking the relevant value for chinese language and add this value to the parameter : zcsa/installed_languages
    Regards,
    Siddhesh

  • How to display chinese in applet?

    I am using an english Win2K and IE6.0. In accessing a web site, the applet couldn't display chinese, instead, it displays little squares. What settings do I need to change? Or is it possible?
    Thanks.

    hi
    I would recommend that you read the following article
    http://www.onjava.com/pub/a/onjava/2001/04/12/internationalization.html
    Jaric Sng

  • How to display chinese

    please see picture,I want the Prompt display chinese
    thanks

    Sorry, we cannot see pictures.
    You need to provide version of JDev and a description of what you are trying to accomplish

  • How to display bengali language correctly in mac os x

    It's not displaying bengali language correctly. my operating system is mac os x 10.4.11

    See also:
    * http://en.wikipedia.org/wiki/Help:Multilingual_support_%28Indic%29 Wiki: Help:Multilingual support (Indic)

Maybe you are looking for

  • Best output for MOS Super 8 telecined project

    I've finished my project (with the generous help found in this discussion group), which is now 1 hour 16 minutes of old Super 8 footage I've had telecined and transferred to digital files. No audio, just video. I'd like the end product to be a DVD pl

  • SMB makes life unbearable for AFP network directory users

    We have a an XServe/XServe RAID combo running 10.4.11 acting as a home directory server for around 20-30 simultaneous users. Most use network home directory accounts served by AFP to desktop Macs. A handful use PCs (SMB access) or Linux boxen (NFS ac

  • Adobe premiere CC 2014 keeps crashing

    I have been experiencing this problem for the past two days. The program only runs smoothly for the first 15 minutes after which scrubbing through your timeline becomes impossible. After that,the program crashes. I've tried uninstalling & reinstallin

  • Email client functionality.

    Because BIS is not available on BB10, I was forced to get rid of my @rogers.blackberry.net address. The new BB way is to use only web based or exchange type mail service. However, I need the ability to forward emails to the phone only. I can live wit

  • Different OPCODE's between tie and stub

    Hello I am using wscompile to generate both server and client classes for a web service. Of course I am using the appropriate "-gen:server" and "-gen:client" options for each call. The problem is that operations OPCODE's are different between the Tie