Displaying Chinese read from resource bundles

I have trouble displaying Chinese characters in my application. The text strings in the application that is shown to the user are put into resource bundles (ResourceBundle). In the file text_zh_TW.properties, the chinese text strings are located. The file is stored in UTF-8 format.
When I fetch a chinese string from this file and display it in the GUI, it is not dispalyed properly. It is displayed almost like this '����>'.
When I "format" the file by using native2ascii, the chinese chars are replaced by unicode escape numbers in the file. Then it works. But I will rather not format the file, because it makes maintanence more difficult.
I'm using JBuilder as development tool.
Does anyone know how to do this?

u are just trying to do nothing but the internalisation concept. usually wat we do is that for example if we want o display any french language or german language we just use go to the corresponding trnslating websites and fetch those french words or any other corresponding language and use to store those words .properties file and after that we will display those words for the selected language.
now ur problem is that as we dont have chinese letters in our keyboards u just go to the sites which will translate those words u mention and u just take a print screen and convert those words by cutting using mspaint and save it as .jpg file format and display those wods correspondingly....

Similar Messages

  • Utf-8 from resource bundle?

    I've been looking at many resources and see this is a common problem but still haven't found solution to desplaying unicode data.
    Page starts with <%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %> and has <meta http-equiv="content-type" content="text/html; charset=utf-8"> in the html head tag.
    Output from all database derived unicode characters look fine. However, output from resource bundle is garbled. i.e. "Espa�ol" comes back as "Espa&#195;&#177;ol".
    Using Tomcat 5 where I set URIEncoding="UTF-8" in the Connector tag.
    Also have a catch all filter setting.
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    and I've duplicated the settings in the jsf file.
    I'd really appreciate any ideas what I'm doing wrong or what more I need to add?

    ResourceBundle Properties uses java.util.properties. If you look closely in
    http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
    you can see it is not using UTF-8, but only ISO 8859-1.
    There is no easy solution for this problem.
    If you are using JSE 5.0 you can view sun newletter
    http://java.sun.com/developer/JDCTechTips/2005/tt1018.html
    Hope it helps.

  • How to set title of jsp page from resource bundle

    hi ,
    How to set title of jsp page from resource bundle....

    Depends on how you configured and declared the resourcebundle in your JSP. The usual way is just<title>${resourceBundle.messageKey}</title>

  • I cannot display image (read from oracle BLOB field) on browser?

    I cannot display image (read from oracle BLOB field) on browser?
    Following is my code, someone can give me an advise?
    content.htm:
    <html>
    <h1>this is a test .</h1>
    <hr>
    <img  src="showcontent.jsp">
    </html>showcontent.jsp:
    <%@ page import="com.stsc.util.*" %>
    <%@ include file="/html/base.jsp" %>
    <% 
         STDataSet data = new STDataSet();
    //get blob field from database     
         String sql = "SELECT NR FROM ZWTAB WHERE BZH='liqf004' AND ZJH='001'";
         //get the result from database
         ResultSet rs = data.getResult(sql,dbBase);
         if (rs!=null && rs.next()) {
              Blob myBlob = rs.getBlob("NR");
              response.setContentType("image/jpeg");//
              byte[] ba = myBlob.getBytes(1, (int)myBlob.length());
              response.getOutputStream().write(ba);
              response.getOutputStream().flush();
         // close your result set, statement
         data.close();     
    %>

    Don't use jsp for that, use servlet. because the jsp engine will send a blank lines to outPutStream corresponding to <%@ ...> tags and other contents included in your /html/base.jsp file before sending the image. The result will not be treated as a valid image by the browser.
    To test this, type directly showcontent.jsp on your browser, and view it source.
    regards

  • How can we set page title from resource bundle

    Hi friends ,
    how can we set page title from resource bundle,
    <%--
        Document   : MARC008Music
        Created on : Aug 4, 2008, 6:27:06 PM
        Author     : root
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
    <title>All Transaction Log Details </title>
          </head>
        <body>
            <f:view>
                <f:loadBundle basename="#{utility.resourceBundle}" var="rb"/>
                <f:loadBundle basename="#{utility.messageBundle}" var="mb"/>
                <h:form>
                </h:form>
            </f:view>
        </body>
    </html>i want set title( All Transaction Log Details ) from resource bundle.

    My problem is solved , Thanking you Sir.
    Thanks & Regards,
    Edukondalu Avula

  • How to display Image as Error instead of Error Message from Resource Bundle

    hi,
    I want to display images as error instead of error message from Application Properties in struts1.1
    Ex:
    I want to prompt a user to type password length min. of 6 char. If failed, need to show simple image as error rather
    "Length should be min. 6".
    reagrds
    parthiban.

    BalusC wrote:
    RahulSharna wrote:
    in the respective resource bundle modify the value by something was below
    error.password.length=<img src="/images/password-Length.gif" alt="Password Length Issue" align="center"/>
    OK, it apparently allows HTML in error messages.Yes struts allows it :)

  • Display chinese characters from oracle 8i database using UTF-8

    I have written a program to retrieve chinese characters from the database and display in the web page.If I change the encoding of the webpage manully it displays the chinese characters(&#27604;&#20998;&#21345;&#29255; ).Or it shows the junk characters(�������� ).Can anybody help so that do I have to do any encoding or any other settings?.I am using Jdeveloper.
    Rgds
    Ganesh
    <HTML><HEAD><TITLE>Welcome to METRO</TITLE>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <%//@ page contentType="text/html; charset=UTF-8" %>
    <%@ page import="java.io.*,java.io.InputStream,java.nio.*,java.lang.*,java.util.*,javax.naming.Context,java.sql.Connection,javax.sql.DataSource,javax.naming.InitialContext,java.sql.*" %>
    </HEAD>
    <BODY >
    <%
    String value="";
    try{
    Connection dbConn;
    Statement stmt=null;
    Context jndiCtx=new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource)jndiCtx.lookup( "jdbc/webdbPooledDS" );
    dbConn= ds.getConnection();
    stmt=dbConn.createStatement();
    String sql="select prog_name_LL2 from wb_prog_new_metro where table_name='SCORE_CARD'";
    ResultSet rs = stmt.executeQuery(sql);
    if( rs.next()){                    
    value=rs.getString(1);
    out.println(value);
    }catch(Exception e){
    System.out.println("Exception ="+e.getMessage());
    %>
    </BODY></HTML>

    Make sure that you have a Unicode font that supports Chinese characters. I have been testing the support of Unicode text (allows many other character and image based languages to be displayed) and have found that it depends on what fonts are available on the system you're viewing the report on. Unicode is supported in Crystal (since version 9 I believe) but it will display '?' or '[]' if there isn't a font to render the text properly.
    This font supports loads of languages: http://www.code2000.net/code2000_page.htm

  • Reading from resource file in JSP

    I'm trying to create a help system in an application I'm working on. I've created a javascript method that onloading of the page goes and attaches onclick events to all the fields with a particular class. That function needs to use the id of that node to look up a message from the resource.properties.
    My issue is I'm trying to make the resource.properties available to my javascript. I realize that the messageBundle is server side and javascript is not, but I was hoping I could iterate through the messages and create a javascript array of the messages by embedding javascript variable declaration inside the forEach loop.
    The reason I'm doing it this way is I want to just be able to go through and aed an ID to the field on all my pages that I want to add help for. I don't want to have to have to build an onclick event for each and every field.
    Any ideas or suggestions?
    I went so far as trying to load a map of messages in through java, but the MessageResources class doesn't have an iterator.

    I was doing ResourceBundle
    test = ResourceBundle.getBundle("....resources.properties");
    instead of
    test = ResourceBundle.getBundle("....resources");
    Thanks for the help

  • Displaying Chinese Characters in JFrame

    I was trying out some sample code in "Java Internationalization" for Chinese, and I am having problems viewing Chinese characters in JFrame. They show up as squares/rectangles instead of glyphs. I read that I needed to download Microsoft's Arial Unicode. I went to the site and discovered that Microsoft's TrueType core fonts for the Web are no longer available for download.
    Am I doing something wrong in the code? If the code is OK what should I do?
    The following is code based out of the O'Reilly book:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class NoInChinese extends JPanel {
    static JFrame frame;
    static String aSentence = "No in Chinese is, \u4e0d.";
    public NoInChinese(String characters) {
    Font theFont = new Font("Bitstream Cyberbit", Font.PLAIN, 20);
    JTextArea area = new JTextArea(characters, 2, 30);
    area.setFont(theFont);
    area.setLineWrap(true);
    JScrollPane scrollpane = new JScrollPane(area);
    add(scrollpane);
    public static void main(String argv[]) {
    NoInChinese chinesePanel = new NoInChinese(aSentence);
    frame = new JFrame("Test");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    frame.getContentPane().add("Center", chinesePanel);
    frame.pack();
    frame.setVisible(true);
    Aggie

    Thanks fsato4, i have set the font to SimSun and can display the chinese char in unicode.
    However, i modified the source code a little to read from resource bundle. Here's my codes:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.text.MessageFormat;
    public class NoInChinese extends JPanel {
      static JFrame frame;
      static String aSentence = "No in Chinese is, \u4e0d.";
      Font font = new Font("SimSun",Font.PLAIN, 12);
      private static ResourceBundle messages;
      public NoInChinese(Locale currentLocale,String characters) {
        messages = ResourceBundle.getBundle("rb",currentLocale);
        JTextArea area = new JTextArea(characters, 10, 30);
        area.setFont(font);
        area.setLineWrap(true);
        area.append(System.getProperty("line.separator"));
        // this line will show glyph.
        //area.append(convert(messages.getString("FileMenu")));
        // this line will show the correct char
        area.append(convert(messages.getString("FileMenu")));
        area.append(System.getProperty("line.separator"));
        area.append(convert(messages.getString("EditMenu")));
        area.append(System.getProperty("line.separator"));
        area.append(convert(messages.getString("CancelMenu")));
        JScrollPane scrollpane = new JScrollPane(area);
        add(scrollpane);
      public static String convert(String theString) {
        String theNewString = theString;
        // String encoding = "CP1252";
        String encoding = "ISO-8859-1";
        String newEncoding = "GB18030";
        if (newEncoding != null) {
          try {
            byte[] convertedBytes = theString.getBytes(encoding);
            theNewString = new String(convertedBytes, newEncoding);
          } catch (Exception e) {
            System.err.println("Not able to convert " +
                                encoding + " " + newEncoding);
        return theNewString;
      public static void main(String args[]) {
        Locale currentLocale = new Locale("zh", "CN");
        NoInChinese chinesePanel = new NoInChinese(currentLocale,aSentence);
        frame = new JFrame("Test");
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {System.exit(0);}
        frame.getContentPane().add("Center", chinesePanel);
        frame.pack();
        frame.setVisible(true);
    }If i just read the unicode string from the resource bundle and display, glyph char will display. I have to use the convert method to read in as encoding "ISO-8859-1" then form a new string with GB18030, then i am able to see the display correctly.
    Why is this so?
    My resource bundle file looks like that:
    FileMenu=\u00ce\u00c4\u00bc\u00fe
    EditMenu=Edit
    CancelMenu=\u00c5\u00c5\u00b3\u00fd
    Thank you!

  • Resource Bundle and encoding

    Hi,
    I'm too confused abt the encoding stuff that java does. First of all, I have a resource bundle written in chinese (Big5), in my program I've used getString(key) to retrieve the corresponding value to be displayed on the html page. I've got a few questions.
    1) From what I've understand, String is always in Unicode. Does that mean that when the string I've retrieved from Resource Bundle is converted to Unicode?
    2) When I do String a = ResourceBundle.getString(key), in order to display the correct Chinese character, I should do new String(a.getBytes("Big5")), right?? But i've got some weird characters. Why?
    3) It will work if I use new String(a.getBytes(), "Big5").
    I know that if I use a.getBytes(), it will return me bytes[] encoded using the system default encoding (in my case, Cp1252). But why is it returning me the correct string since my Resource Bundle is written in "Big5"? Or will getString(key) do some encoding?
    4) It will also work if I use this:
    BufferedReader reader = new BufferedReader(new InputStreamReader(new StringBufferInputStream(a),"Big5"));
    the display will be correct, why is this so? Is there any other class besides StringBufferInputStream as it is deprecated.
    I've been researching on this encoding topic for quite some time but didn't manage to understand it at all. Please help!! Thanks!

    Hi,
    I'm too confused abt the encoding stuff that java
    does. First of all, I have a resource bundle written
    in chinese (Big5), in my program I've used
    getString(key) to retrieve the corresponding value to
    be displayed on the html page. I've got a few
    questions.PropertyResourceBundles should be converted using the native2ascii tool. ListResourceBundles should be compiled with the -encoding flag. In your case:
    1. native2ascii -encoding Big5 resource.txt bundle.properties, or
    2. javac -encoding Big5 bundle.java
    >
    1) From what I've understand, String is always in
    Unicode. Does that mean that when the string I've
    retrieved from Resource Bundle is converted to
    Unicode?Once you have compiled the ResourceBundle, all text objects are represented as Unicode. Your retrieved String is Unicode text.
    2) When I do String a = ResourceBundle.getString(key),
    in order to display the correct Chinese character, I
    should do new String(a.getBytes("Big5")), right?? But
    i've got some weird characters. Why?No, you should not try to convert the String further. You have a perfectly good Unicode String at that point. You have weird characters after the above operation because you are converting Big5 text to a Unicode String using the default charset on your host...which may not be Big5 at all. In fact, it is not Big5 since you say you see strange characters.
    3) It will work if I use new String(a.getBytes(),
    "Big5").
    I know that if I use a.getBytes(), it will return me
    bytes[] encoded using the system default encoding (in
    my case, Cp1252). But why is it returning me the
    correct string since my Resource Bundle is written in
    "Big5"? Or will getString(key) do some encoding?Do not convert the String. Your operations with getBytes and new String() are an attempt to recreate the original String...which you already have...it is unnecessary.
    4) It will also work if I use this:
    BufferedReader reader = new BufferedReader(new
    InputStreamReader(new
    StringBufferInputStream(a),"Big5"));
    the display will be correct, why is this so? Is there
    any other class besides StringBufferInputStream as it
    is deprecated.Do not convert the String. It is already usable.
    >
    I've been researching on this encoding topic for quite
    some time but didn't manage to understand it at all.
    Please help!! Thanks!String a = bundle.getString(SOME_KEY);
    component.setText(a);
    This should be sufficient to retrieve and display the text, assuming all else is correct.
    Regards,
    John O'Conner

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • Is there a way to 'reload' a Resource Bundle?

    Dear All,
    Use Case:
    I confgured a bundle in my faces-config.xml
    <resource-bundle>
      <base-name>com.test.MyBundle</base-name>
      <var>myBundle</var>
    </resource-bundle>..and my Bundle class loads data from a database table. So instead of using properties file, I saved the labels in a table
    using this code.
    public class MyBundle extends ListResourceBundle {
        public Object[][] getContents() {
              Object[][] resource;
            ResourceLabels lView = ADFBCUtil.getAppModule().getResourceLabelViews();
                   More codes
            return resource;
    }Now here goes my problem... supposed somebody changed the label in the DB table and wanted that to reflect to the new label.
    Is there a way to re-initialize my bundle?
    What happens is that, I need to restart the application so that it would read the table again. As I notice, the ADF app reads this
    bundle only once during startup
    Any Hints. Thanks.
    JDEV 11G 11.1.1.5

    vinod_t_krishnan wrote:
    why cant you do this.. operation in the button click.. so that the binding or the underlying objects gets updated..
    ADFBCUtil.getAppModule().getResourceLabelViews();
    Hi Vinod,
    That isn't what I am trying to do. Let me try to explain my use case again.
    1. I configured a Resources bundle in faces-config.xml
    2. When my application starts, it reads the configured bundle.
    3. Since I configured my bundle to load contents from database, it will query my table once during startup. The list of labels/messages are now in my bundle.
    4. User change something in my label(s) table and he/she want's it to be displayed automatically in the UI
    5. So he/she should be able to reload/reinitialize my bundle. This is where I am having trouble
    I am thinking of having an ADMIN screen where there is a button to click that will reload/reinitialize my bundle.
    But my problem is how do I tell my ADF app to reload the bundle again?
    A quick alternative is to restart my application since this will read the resource bundle again during startup. But this is not what I wanted.

  • Cannot Input and Display Chinese Characters by using ODBC Applications

    Dear all,
    I am trying to input the Simplified Chinese Characters in the Oracle Database Ver 9.2 running on a UNIX AIX server. The client application we are using is th MS Access 2003 running on a MS Windows XP English version SP 2 without multi-language pack. MS Office 2003 is also an English version.
    Database setting is:
    NLS_CHARACTERSET=US7ASCII
    NLS_NCHAR_CHARACTERSET=AL16UTF16
    The Oracle Client used is also ver 9.2 with the ODBC driver ver 9.2. I have tried the following NLS_LANG settings by chaging the registry without any NLS_LANG environment settings:
    AMERICAN_AMERICA.ZHT16MSWIN950
    AMERICAN_AMERICA.ZHS16GBK
    AMERICAN_AMERICA.ZHT16HKSCS
    AMERICAN_AMERICA.AL32UTF8
    I have tied to load some Chinese Characters in by sqlload and by using the NLS_LANG AMERICAN_AMERICA.ZHT16MSWIN950, AMERICAN_AMERICA.ZHS16GBK and AMERICAN_AMERICA.ZHT16HKSCS, they can be display perfectly in SQLPLUS. But when using the same NLS_LANGs and display in the ACCESS, only ???? are displayed.
    When I tried to insert Chinese in ACCESS, the character changed to ???? again. No matter what Chinese characters I inserted by MS ACCESS, the ???? code can be dump with the binary code "03, 0f".
    Are there any methods or settings I need to change to make ACCESS an application for inserting and displaying Chinese characters from the Oracle database?
    I have tried to set the Non-Unicode setting in the Windows Locale setting:
    Chinese (Taiwan) (With AMERICAN_AMERICA.ZHT16MSWIN950),
    Chinese (Hong Kong S.A.R) (with AMERICAN_AMERICA.ZHT16HKSCS) and
    Chinese (PRC) (with AMERICAN_AMERICA.ZHS16GBK)
    when inserting the Chinese Characters by Access. But they all failed with ???? inserted in the DB.
    Please kindly advise what should be done.
    Thanks.

    Are you trying to store the character data in char/varchar2 columns?
    If that's the case then you have a problem, since a US7ASCII character set can only handle, well, ascii data.
    If you are trying to store the data in columns of nchar datatypes, then there might be a problem with literals because literals are converted to database character set first, before conversion to national (nchar) character set. Such data loss can also happen depending on how binds or oci calls are performed.
    You could use the dump() function to verify what's actually stored in a database column, without a db - client conversion happening that may distort the facts.
    Example:
    SQL> select col, dump(col, 1016) from table where some_condition;

  • Accessing resource bundle in h:inputText

    Hi,
    I am trying to dynamically populate the label attribute of <h:inputText tag;
    <h:inputText id="fullNameField" value="#{newUserFormBean.fullName}"
                                  label="#{resourceBundle.fullName}">
    <f:validateLength minimum="3" maximum="64"/>
    </h:inputText>When I validate this field i want to populate the error message with the value of label attribute from resource bundle. But it isn't showing up anything, but if i hard code the value of the label field, it displays that value. How do i resolve it?
    Thanks.
    Edited by: Mujju101 on Aug 29, 2010 10:26 PM
    Edited by: Mujju101 on Aug 29, 2010 10:26 PM

    Yes it does show up when i use
    <h:outputLabel value="#{resourceBundle.label_fullName}:" styleClass="label" />or either:
    <h:outputText value="#{resourceBundle.label_fullName}:" styleClass="label" /> It errs only when used in <h:inputTextEdited by: Mujju101 on Aug 30, 2010 1:17 AM
    Edited by: Mujju101 on Aug 30, 2010 1:18 AM

  • Problems displaying Chinese characters

    Safari cannot display Chinese characters from time to time. It would work in one session but it failed to display Chinese characters in another session even with the same settings in the Preferences. Can anyone give me some advice please?

    Safari cannot display Chinese characters from time to
    time. It would work in one session but it failed to
    display Chinese characters in another session even
    with the same settings in the Preferences. Can
    anyone give me some advice please?
    The preferences don't necessarily matter. You most likely need to adjust the encoding in View > Text Encoding. If you will provide the url of an example page where you have a problem I can probably offer more specific help.

Maybe you are looking for

  • Problem in Transporting -urgent

    Hi gurus I have created Infoobjects,update rules,and PC i hv trasported these to Testing evironment.these are ended with errors in Testing. saying that there is no active version available.for all the things.But in Devlpment sys these are all in acti

  • Question about setup ewa in solution manager 4.0

    Hi I tried to setup ewa in solution manager 4.0, but when I clicked on the "setup EarlyWatch alert", it told me that: the Service is not available, Fehlercode:ICF-NF-http-c:000-u:SAPSYS-l:D-i:saptux04_SM4_04-v:0-s:403-r:Forbidden HTTP 403 - Forbidden

  • How do I rebuild catalogue or recover data from an external hard drive?

    I have a 2 Tb western digital hard drive that I keep  my photos on. I seem to have corrupted the catalogue file. My OS 10.7.5 shows the disk as empty, Apple's Disk utility tells me that the disk is ok. So my question is how do i rebuild the catalogue

  • [Solved] Missing XFCE4 Theme

    Hello everyone, I am searching for a theme for XFCE4 that was available in past but now that I've done a fresh install I can't find it :S... This was my desktop pc with my Xfce4 with arch linux : http://aliasbody.deviantart.com/art/My- - -251240540 I

  • Is it possible to lock audio tracks so they do not fragment when inserting clips into the video line -  Elements 13

    The question says it all.   If the answer is no,  is there a work around?  I'd really appreciate help with this - very frustrating (but possibly simple when you know how)