This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes Character encoding 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 » Applets
Bookmark "Character encoding" Watch "Character encoding" New topic
Author

Character encoding

Prakash Adidam
Greenhorn

Joined: Sep 18, 2009
Posts: 1
In our application we have to provide the user with an option to select a destination directory to download files from server. To enable this I have developed a signed applet to enable the user to select the destination directory.

The applet displays a directoy selection box, user selects the required destination directoy and then the applet sets the destination directoy string to a html hidden form field.

When the user submits the page this destination directory is then used by the application to download files to that directory.

The application works fine when the character encoding is windows-1252, MacRoman or ISO-8859-1.

However, the system doesnt function properly when any user selects a directory thats in japanese language. To fix this i have changed the jsp pages character set encoding to UTF-8 from IS0-8859-1. With this change, the destination directory path string gets currupt when its transfered from applet to html hidden form field. The characters after the "\" character (windows path separation character) are interpretted as escape sequences and the string looses the actual path info.

e.g. C:\Documents and Setting\113XXX\Desktop\test changes to Cocuments and SettingskXXXDesktop est

As per my understanding this should have been automatically handled by java while changing the character set encoding.

I have tried to change the character encoding by picking the default character encoding of the system to UTF-8 using the nio classes.

Request the members of the forum to help me find a solution to this.

Thanks in advance for any solutions or suggession.

Regards,
Prakash.
Jasper Vandaele
Greenhorn

Joined: Sep 28, 2009
Posts: 2
You can try to re-encode the String containing the path in your applet by using the String constructor that takes the encoding as second argument. This way you do not depend on the encoding of the client's system.
Re-encode the String before passing it to your html form. Use the same encoding for your jsp.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Character encoding
 
Similar Threads
IBM Test 340
Test 340 Answers
Character Encoding and Copyright Character
Few Doubts about encoding
Passed 700,701 and 340 last Thursday