aspose file tools*
The moose likes JSF and the fly likes  Problem I18N with JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark " Problem I18N with JSF" Watch " Problem I18N with JSF" New topic
Author

Problem I18N with JSF

somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
I have problem in I18N with JSF on my application.

My application MUST support multiple language such as English, Thai , Chinese .. etc.

Now i have problem with Thai language.

My solution to do that ::
- use properties file. ( Use UTF-8 Encoding )
- load properties file in jsp page

when i change language that i change Local of context in ManageBean code BUT in jsp page display ???.

I don't khnow how to fix this problem ???

Do you have some solution to solve my problem ?

thank you.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Isaias C. Barroso
Ranch Hand

Joined: Jan 22, 2002
Posts: 165
This problem ocurrs in any browser?
Whats you output if you get the Accept-Charset header of your HTTP Connection?


Isaias
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Isaias C. Barroso:
This problem ocurrs in any browser?


ํำYes, i tested in ie and firefox browser.

Originally posted by Isaias C. Barroso:

Whats you output if you get the Accept-Charset header of your HTTP Connection?


UTF-8
Isaias C. Barroso
Ranch Hand

Joined: Jan 22, 2002
Posts: 165
In Firefox, whats the Character Encoding that is selected when ??? characters are being showed?
Isaias C. Barroso
Ranch Hand

Joined: Jan 22, 2002
Posts: 165
Menu View -> Character Encoding
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Isaias C. Barroso:
In Firefox, whats the Character Encoding that is selected when ??? characters are being showed?


Default is UNICODE ( UTF-8 ).
Peter Goldstein
Greenhorn

Joined: Feb 26, 2006
Posts: 15
A couple of quick comments.

First, I'm not quite sure how you're doing your i18n - your description doesn't have enough detail. I suspect you may have some problems there, in part because I don't see a discussion of ViewHandlers in your posts. See the postings here -

i18n posting

- for a basic discussion of how to do i18n in JSF apps.

Second, this may very well be a character encoding issue. There's a lack of control by the developer over the response character encoding in JSF 1.1. This has been improved in JSF 1.2 with the addition of the calculateCharacterEncoding(FacesContext) method to ViewHandler, but the problem remains in JSF 1.1 apps or JSF 1.2 apps that don't use this new functionality. A discussion of the default response character encoding algorithm in JSF 1.2 apps can be found here -

View Handler javadoc

In MyFaces/JSP based apps I believe the response encoding is basically just copied from the request encoding. That appears to be the default behavior in Facelets based apps (see FaceletViewHandler).

If everything here is ok - you're localizing correctly and the character encodings of the request and response are both UTF-8 - it's time to check your JVM's character encoding and make sure that it's set to UTF-8 so it can properly read your bundles. You can configure the JVM's character encoding - Google for details.

As part of your debugging process you can use a backing bean to print out Strings from the bundle to your log, to confirm that everything is kosher before the String is written out to the response.

Anyway, those are the places I'd start looking for problems. This post should give you a few things to investigate. Hope that helps.

Regards,

Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem I18N with JSF