dcsimg
www.webdeveloper.com
Results 1 to 8 of 8

Thread: Displaying double byte characters

  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Displaying double byte characters

    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?

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Try 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

  3. #3
    Join Date
    Jun 2009
    Posts
    4

    Question ???

    Charles,

    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.

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    You are incorrect. http://en.wikipedia.org/wiki/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

  5. #5
    Join Date
    Jun 2009
    Posts
    4

    I see

    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?

  6. #6
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    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

  7. #7
    Join Date
    Jun 2009
    Posts
    4
    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.

  8. #8
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    You may have to give up and give us links.
    “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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles