I'm working on support for a client. On some pages the client can dynamically create/edit forms and add them to a content page. Some of the pages, auto-fill text input fields with data after login. We receive an XML with the data and then fill the fields. The problem I'm having is that the client is international, and some of the XML data uses Japanese characters which I believe are double byte characters. The characters are correct/visible in the XML, but after we read them in and display them, the html input fields contain "?????" instead of said characters. I have already tried converting the strings by creating a new String and using getBytes("UTF-16"), but that isn't working. I have also tried setting the html charset to "UTF-16" in the Meta tag, but that breaks the page. Any suggestions?
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
I appreciate the feedback, but that certainly doesn't work. That's what the original code is set to do. From what I understand, UTF-8 is limited to 255 characters. As far as I know, there are no Japanese characters in that set.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Thank you, that made the topic much more understandable! Other articles I've read did not convey the idea correctly. However, as we are currently using "UTF-8", that must not be the problem. I wonder if the XML is using a different charset. Could that cause a problem?
Are you certain that you are using UTF-8 currently? XML defaults to UTF-8.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Yes, currently everywhere in the code we get Strings we use UTF-8. However, I'm not sure how the XML is encoded, as it comes from a different party's webservice.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Bookmarks