Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Character encoding

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 C:Documents 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.

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
What's a year in metric? Do you know this metric stuff tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic