My XForms form support foreign characters. When i input some chinese characters in the form and make it lose focus, i see the correct characters being passed to XFormsServer. Here is the logs on focus out on the text field:
2011-05-17 12:34:24,879 DEBUG XFormsServer - xforms:setvalue - setting instance value {value: "test chinese 中文 中文", changed: "true", instance: "project_abstract-instance"} Btu when i submit the form, the XML data passed to my REST service doesn't contain the chinese characters. Here's the logs (specifically from HttpClient when orbeon does the actual HTTP PUT to my REST service): 2011-05-17 12:36:12,354 DEBUG content - >> " <ProjectTitle>test chinese [0xe4][0xb8][0xad][0xe6][0x96][0x87] [0xe4][0xb8][0xad][0xe6][0x96][0x87]</ProjectTitle>[\n]" see the chinese characters get converted to [0xe4][0xb8][0xad][0xe6][0x96][0x87] and [0xe4][0xb8][0xad][0xe6][0x96][0x87]. and this is what i get from my Java String: <Project_AbstractSummary:ProjectTitle>test chinese ä¸æ ä¸æ</Project_AbstractSummary:ProjectTitle> Any idea how to fix this? |
Administrator
|
Bryan,
It's probably an encoding issue. By default, when you submit XML, the encoding is in UTF-8. Do you decode the XML using UTF-8 on the other side? -Erik On Tue, May 17, 2011 at 9:38 AM, Bryan <[hidden email]> wrote: > My XForms form support foreign characters. When i input some chinese > characters in the form and make it lose focus, i see the correct characters > being passed to XFormsServer. Here is the logs on focus out on the text > field: > > 2011-05-17 12:34:24,879 DEBUG XFormsServer - xforms:setvalue - setting > instance value {value: "test chinese 中文 中文", changed: "true", instance: > "project_abstract-instance"} > > Btu when i submit the form, the XML data passed to my REST service doesn't > contain the chinese characters. Here's the logs (specifically from > HttpClient when orbeon does the actual HTTP PUT to my REST service): > > 2011-05-17 12:36:12,354 DEBUG content - >> " <ProjectTitle>test chinese > [0xe4][0xb8][0xad][0xe6][0x96][0x87] > [0xe4][0xb8][0xad][0xe6][0x96][0x87]</ProjectTitle>[\n]" > > > see the chinese characters get converted to > [0xe4][0xb8][0xad][0xe6][0x96][0x87] and > [0xe4][0xb8][0xad][0xe6][0x96][0x87]. > > and this is what i get from my Java String: > > <Project_AbstractSummary:ProjectTitle>test chinese ä¸æ–‡ > ä¸æ–‡</Project_AbstractSummary:ProjectTitle> > > Any idea how to fix this? > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/XFormsServer-not-sending-unicode-characters-tp3529801p3529801.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Found the problem.. It's a CXF issue. The XML data that CXF passed to my REST service isnt properly encoded so i have to manually fix my string using this code:
byte[] bytes = new byte[utfEightString.length()]; for (int i = 0; i < utfEightString.length(); i++) { bytes[i] = (byte) utfEightString.charAt(i); } return new String(bytes, "UTF-8"); |
Free forum by Nabble | Edit this page |