Arun,
The JSP engine should not really care about the encoding of the information
present
within property resource bundles. The specific charset value can also be
specified
an additional resource, of course. For example, data for most of the non
ISO-8859-1 compliant
languages like Korean, Japanese, Chinese, etc. can be represented in
UTF-8 format. You can obtain Unicode sequences for any Asian character from
a
number of sites...I like the following applet from Netscape which does a
decent job:
http://home.netscape.com/eng/intl/tests/unicodestrings.html
Borrowing a bit from Jason's servlet :), here is a simple example that
displays
"Hello World" in Japanese.
<%@ page import="java.util.*" %>
<%
response.setContentType("text/plain; charset=Shift_JIS");
ResourceBundle bundle = ResourceBundle.getBundle("Nippon");
String s = bundle.getString("msg");
out.println(s);
%>
Nippon.properties can be specified as:
msg=\u4eca\u65e5\u306f\u4e16\u754c
Of course, your browser needs to support Japanese fonts. Since adding exotic
font support may seem like 3-ring circus at times,
I suggest you simply download the latest version of MSIE v5.x and try out
the example...it comes with all the bells and whistles.
cheerio,
Govind Seshadri
jGuru.com
> Govind,
>
> I'm hoping you can help clarify a point about localization that I've been
> able
> to find little comment about.... In the last few lines of your JavaWorld
> article,
> you write:
>
> If you are using something other than the ISO-8859-1 character set, you
> must communicate this to the browser using the contentType attribute of
> the page tag, as:
> <%@ page contentType="text/html; charset=charset_name" %>
>
> You follow on to explain the compliancy requirements of the browser.
>
> My question deals with the JSP engine (and ResourceBundles for that
matter).
> How do these objects know the encoding used to store the JSP Page or
> Property file? In order to read in these items for parsing into JSP
> Servlets/
> ResourceBundles, some particular encoding must be used. I can't
understand
> how
> the engine could possible determine the encoding to use for a particular
> file
> based on information stored within the file (the @page directive above).
In
> the case of ResourceBundles, as far as I can see, the getBundle method
must
> be
> assuming a particular encoding for the Property files, as none of the
> various
> method signatures provide any means to specify the encoding to use.
>
> Any clarification would be greatly appreciated.
>
> Thanks for a good article.
> -AMT
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Govind Seshadri
> > Sent: Friday, April 07, 2000 11:05 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: localization
> >
> >
> > You may be interested in an article I'd written on JSP and i18n for
> > JavaWorld:
> > http://www.javaworld.com/javaworld/jw-03-2000/jw-03-ssj-jsp.html
> >
> > Govind Seshadri
> > >
> > > ----- Original Message -----
> > > From: Kevin Duffey <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, April 07, 2000 8:17 PM
> > > Subject: Re: localization
> > >
> > >
> > > > Just a note, the abit-use.com site has a language drop-down that
shows
> > > their
> > > > site in I think 10 different languages. Pretty kewl looking,
> > but you may
> > > > want to email them somehow and ask how they achieved it.
> > Maybe there is
> > a
> > > > free translation kit or something. :)
> > > >
> > > >
> > > > >-----Original Message-----
> > > > >From: A mailing list about Java Server Pages specification and
> > reference
> > > > >[mailto:[EMAIL PROTECTED]]On Behalf Of Hui Deng
> > > > >Sent: Friday, April 07, 2000 10:22 AM
> > > > >To: [EMAIL PROTECTED]
> > > > >Subject: localization
> > > > >
> > > > >
> > > > >Hi,
> > > > >I'm currently working on an i18n prototype and need
> > > > >you guru input before I go too far.
> > > > >The orignal web site totally has 700+ pages including
> > > > >jsp and few html. For the primary consideration, we
> > > > >now just want to work with localization of static
> > > > >content in page. We want to achieve:
> > > > > 1. based on user language preference, display the
> > > > >pages in user's language.
> > > > > 2. avoid to keep x copies of 700+ pages for
> > > > >x languages, instead, only keep one copy, so that we
> > > > >don't bother to change the UI.
> > > > >
> > > > >To do this, first come to my mind is to use database.
> > > > >Separate the static content in page as blocks and
> > > > >assign ids to blocks. Put these content blocks in
> > > > >database. In jsp page, we have placehold for these
> > > > >contents. Then for every request for that page(jsp),
> > > > >queries the database and pulls out content blocks for
> > > > >that page. Also use database, we can easily manage and
> > > > >
> > > > >coordinate(web based) the localization, like sending
> > > > >email if any content block be change in page XX.
> > > > >
> > > > >For alternative I could imagine is use XML. Each page
> > > > >has a corespond xml file. In jsp page, parser is
> > > > >called to take xml file and fill in content.
> > > > >
> > > > >Is this the way to do the job, or is there any tool
> > > > >to work with jsp for this purpose?
> > > > >
> > > > >Thanks in advance for any suggestion.
> > > > >
> > > > >Hui Deng
> > > > >
> > > > >__________________________________________________
> > > > >Do You Yahoo!?
> > > > >Talk to your friends online with Yahoo! Messenger.
> > > > >http://im.yahoo.com
> > > > >
> > > >
> > >
> > >=================================================================
> > ==========
> > > > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > > >JSP-INTEREST".
> > > > >Some relevant FAQs on JSP/Servlets can be found at:
> > > > >
> > > > > http://java.sun.com/products/jsp/faq.html
> > > > > http://www.esperanto.org.nz/jsp/jspfaq.html
> > > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > > > >
> > > >
> > > >
> > >
> > ==================================================================
> > =========
> > > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > > Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > > http://java.sun.com/products/jsp/faq.html
> > > > http://www.esperanto.org.nz/jsp/jspfaq.html
> > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > > >
> > >
> >
> > ==================================================================
> > =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets