tags:

views:

48

answers:

2

Japanese Yen Mark is expressed with two ways of next

  • 0x5c (ASCII)
  • 0xa5 (utf-8)

When I did a POST of 0xA5 in Java6, environment of Struts2, at the stage that I output in log, I become 0x5C.

Where will substitution of a character code be performed to be concrete?

+1  A: 

I believe you're asking when it the Yen symbol will become ASCII - the answer is when the underlying default character encoding changes from UTF-8 to ASCII. This could happen in a number of places:

Can you provide some more information on what you currently have set for these?

Jon
A: 

I think that the problem is not character conversion but misconversion or corruption. The character 5C in ASCII is '\'. It is not immediately obvious to me what misconversion would turn A5 into 5C. Are other characters before or after the Yen symbol misconverted as well?

The first two places to start looking for the cause of the problem would be where your code converts from String to byte[] and back again. When converting the POST data on the client side you should make sure that you set the charset that you use in the HTTP request Content-Type header. Then on the server side, make sure that your code uses the charset specified in the incoming request's Content-Type header.

Stephen C