WebObjects 5.2: UTF-8 Exception in WebObjects Web Services

WebObjects 5.2 applications using Web Services frameworks, such as JavaWebServicesSupport.framework, generate WOResponses in the default system encoding of ISO8859_1 (ISO Latin 1) even if the responses contain UTF-8 encoded international characters.
Symptom

When clients of WebObjects 5.2 Web Services applications submit forms with UTF-8 encoded international characters, WebObjects ignores the content encoding specified by the requests. WebObjects instead returns responses in the default ISO Latin 1 encoding. Web Services clients expecting a UTF-8 encoded response see an ISO Latin 1 encoded response, and can stop responding and produce a java.io.UTFDataFormatException when reading the SOAP envelope.

Sample error:

Error: java.io.UTFDataFormatException: Invalid byte 2 of 2-byte UTF-8 sequence.


Solution

Developers can implement a workaround to set the encoding to the appropriate UTF-8.


Published Date: Feb 19, 2012