• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Can't handle languages other than English?

 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple code:

Form page:



And handler page:



If I enter something in English - I have no problem. If I enter something in Russian, I get some crazy letters. Anybody knows how to fix this?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What character set are you using? It's not possible to use the default 8-bit ISO Latin character set with a Cyrillic alphabet.
[ July 13, 2004: Message edited by: Paul Sturrock ]
 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I find out what character set I am using?

I mean all I know is that Russian is cyrillic, and I want my clients to be able to type in Russian (or any other language) and see their stuff on the web. JAVA DOES NOT SUPPORT THAT?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How can I find out what character set I am using

Well as far as your client is concerned it depends what content type you define in the header of your HTML page. If you haven't defined one you are using the default for what ever browser your client has. That is unless your client is IE, in which case IE tries to guess the correct encoding to use based on the frequency of characters in the page. Clever, but it can be quite frustrating if you see some of your pages render fine and others fall over with lots of '?'s.

As far as your server is concerned its using the default encoding - which is defined by JVM, OS and OS locale settings. The JSDK (1.4.2+) is documented to support KOI8-R, windows-1251 and UTF-16 any of which you could use, couldn't you?

As far as multi-language pages go - typically you would not expect one page to be able to transparently support every possible character set. That's why frameworks like Struts include internationalization capabilities. Normally an internationalized site will have a default langauge page plus a differntly encoded page for each anticipated language e.g. home.jsp, home_ru.jsp, home_cz.jsp etc.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible although there are a few pieces of the puzzle that need to be in place. I wrote a fair amount about this here and you can see some example sites running here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!