Discussion - the powerfull way to excellence!
Returns the name of the charset used for the MIME body sent in this response.
If no charset has been assigned, it is implicitly set to ISO-8859-1 (Latin-1).
Originally posted by Gamini Sirisena:
Also check here to learn more about character encodings etc.
Discussion - the powerfull way to excellence!
Originally posted by Gamini Sirisena:
Also check here to learn more about character encodings etc.
Discussion - the powerfull way to excellence!
My requirement is to read the request parameters in UTF-8 format.
Is there a way to do with J2EE/sdk1.2.2.
Originally posted by Ulf Dittmer:
If you retrieve the parameters as strings, then you don't need to worry about this, as the container handles it for you.
You can create a byte[] in any encoding you wish, but why would you want to do that? Do you want to store the parameters someplace else?
Discussion - the powerfull way to excellence!
Originally posted by Ulf Dittmer:
How are you sending the string to the other application? Unless you're using binary serialization, what is sent will not be a Java string object, but a byte[], and you'll need to specify the proper encoding. The String.getBytes(String) method can do that.
Let me give the clear inputs and the outputs.
Binary - hexadecimal - integer - char
11110000 - F0 - 240 - ��
Discussion - the powerfull way to excellence!
Originally posted by Ulf Dittmer:
I don't really understand that table. Can you post the code you're using to do this?
Discussion - the powerfull way to excellence!
Originally posted by Ulf Dittmer:
I can't say that I follow the intent of the code, but I'm getting the impression that you're making it way harder on yourself than it needs to be.
If you want to convert "11110000" to 240, then that's what Integer.parseInt("11110000", 2) does. That number can be cast to a char if need be.
If you want to transfer a string as UTF-8 to some destination, you can get the bytes to transfer using String.getBytes("UTF-8").
Does this help?
Discussion - the powerfull way to excellence!
The output table shown above is from the applogs of the unix machine.
My actual outputs are received from the windows system.
Originally posted by Gamini Sirisena:
Are you saying that in unix you can see the unicode chars correctly but when you view them under windows they are not what you expect? Could you give some more information on these lines? e.g what viewers you are using etc?
Discussion - the powerfull way to excellence!
Originally posted by Ulf Dittmer:
I can't say that I follow the intent of the code, but I'm getting the impression that you're making it way harder on yourself than it needs to be.
If you want to convert "11110000" to 240, then that's what Integer.parseInt("11110000", 2) does. That number can be cast to a char if need be.
If you want to transfer a string as UTF-8 to some destination, you can get the bytes to transfer using String.getBytes("UTF-8").
Does this help?
Discussion - the powerfull way to excellence!
Don't get me started about those stupid light bulbs. |