File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Showing string in different language Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Showing string in different language" Watch "Showing string in different language" New topic
Author

Showing string in different language

amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
Hi,

In a servlet when I am doing:

String s = "\u4F9D\u5B58\u3057\u305F";
out.println(s);

I am able to see the content in Japanese. But when I am getting the same String thorugh a collection like a HashMap I am not able to see the content in Japanese:

Iterator iterator = map1.keySet().iterator();
while(iterator.hasNext())
{
String s = (String) iterator.next();
out.println("s : " + s);
}

I am seeing \u4F9D\u5B58\u3057\u305F on the browser.

What's the reason?

I am setting the response content type to UTF-8:

request.setCharacterEncoding("UTF-8");

response.setContentType("text/plain; charset=UTF-8");
response.setHeader("Content-Language", "ja");
response.setHeader("Vary", "Accept-Language");
response.setCharacterEncoding("UTF-8");

Thanks and Regards,
Amit Sanghai.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

"izon shita"

Are you sure you've got the right values in the map ?
You're using the keys of the map. Check that the s.equals((String) iterator.next());
[ March 16, 2007: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1318


"izon shita"


??

I think is another language words and I thought its used to say Hi! right Satou ?


Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

sorry, it is the japanese sentence supposed to be displayed with the above unicode
izon = dependency
izon suru = to depend on something
[ March 16, 2007: Message edited by: Satou kurinosuke ]
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1318

My guess was wrong in meaning of this sentence.

no need to say sorry for that.. I get my answer in your post..? Thanks for your reply..
amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
Hey, what happened to my question's reply? I have tested, the values in the map are right.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Showing string in different language
 
Similar Threads
Internationlizing JSPs
File name for Excel sheel not showing correctly in Japanese locale
display of japanese characters in excel sheet
UTF-8 and Tomcat
Display problem with Japanese characters