Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java internationalization question: Chinese file name display is grabbed in browser

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I met an issue that when open a file with Chinese name in our application, the popup window ( see attachment) is not able to show Chinese Character, It shows "---" or " __" or "???" depends on diferent browser and OS (Windows and Linux).

The attachment is list the error popup window in IE8 (Chinese character is shown as __) and Firefox (Chinese character is shown as ---) in Windows. The Chinese character is shown as ??? in Firefox in Linux.

Also I tried to open the file from browser firefox and IE, we get the same popup window and it shows the Chinese Character OK.

So looks like the issue is related with file name encoding our product , I checked the file name before it is sent to browser, it is shown correctly as ChineseName, and encoding as UTF-8. I assume UTF-8 is right encoding we need to set for Chinese and am not sure what else I can check for the file name popup window

Any suggestions what else I need to check, or what other encoding I can use this case? (Same issue for Japanese file name)?

Thanks!




ChineseFileName.png
[Thumbnail for ChineseFileName.png]
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps the problem isn't in your application but in the operating system.
Can the browser display Chinese characters on regular web pages?
Can you create files on your file system with Chinese characters in the name?
 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried Windows and Linux, both are OK to display the Chinese Name File ; and also when I open the file with Chinese Name from firefox browser in Linux (not from my application), it pops up same window and shows Chinese File name correctly.

So Looks like the issue is only related with my application, but I am not sure where is the issue or where to debug it further.

Thanks

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue is similar in http://www.codeproject.com/KB/aspnet/NonUSASCII.aspx#Introduction, Display a non-US-ASCII filename in File Download dialog box

Since the above article is documented in 2004, and the no-aciiII file name is displayed correctly in windows with IE, firefox or chrome now. Do we still need to do the additional encoding for file name?

I tried add the encoding for file name as

fileName = URLEncoder.encode(fileName, "utf-8")

and get the different display for file name , like %3a38%3A24.xls. Should we do more encoding for the No-Ascii file name ?

Thanks



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic