I wrote Util.zip and Util.unzip methods to compress big strings, before persisting. It works fine, except when i start using chinese characters (or what i believe to be chinese).
- Posted by: Dieter Cailliau
- Posted on: July 09 2003 10:29 EDT
In the simple test class below, uncommenting line 20 will add chinese characters in the test string, and make the test fail.
Does anyone have any idea if this is somehow my fault, or what can be done about it.
I used sun java version 1.4.0_01-b03.
Just for those not familiar with the the topic of String encodings:
A string of characters can be encoded into bytes in a variety of ways. String.getBytes() uses your system's default encoding, for instance ASCII. Unless you live in Japan, your default encoding probably doesn't support japanese characters. In order to get meaningful results, you must specify an encoding that does. UTF-8 is a common example.
Can i use special characters in java and jsp files? For example i noticed
the euro character can be typed in eclipse, but it certainly is not surviving the jsp -> java -> class -> servlet -> runtime -> html process. So i wonder how the compiler reads jsp files (using which encoding?) and if i can change it somehow. Also important for .properties files...