wood burning stoves 2.0*
The moose likes Java in General and the fly likes Java internationalization question: Chinese file name display is grabbed in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java internationalization question: Chinese file name display is grabbed in browser" Watch "Java internationalization question: Chinese file name display is grabbed in browser" New topic
Author

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

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
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!






[Thumbnail for ChineseFileName.png]

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

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?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
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

Joined: May 17, 2004
Posts: 107
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



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java internationalization question: Chinese file name display is grabbed in browser
 
Similar Threads
What every developer should know about character encoding
file name encoding problem
How to export the chinese character to excel using ExcelCSVPrinter. Open the file within browser
multiple language support in one XML
setting utf-8 in jsp