Displaying diacritic charaters

I have a hybrid application built for android platform using phonegap. In my application I need to display diacritic characters like Polish special signs like (ń ł ć ą ę) in the text area. Currently when I enter those it is getting recognized as some other characters. Any solution to this problem. Any help is appreciated.

Comments

  • Well, Javascript (and therefore Enyo) uses Unicode character encoding, so you need to make sure that you're using that encoding throughout your application:
    1. Make sure any of your .js files that contain accented characters are saved as Unicode text (UTF-8 is probably best)
    2. Make sure that any HTML files are saved in Unicode encoding, *and* that they specify the right encoding in the document header
    http://www.w3.org/International/questions/qa-html-encoding-declarations#quicklookup
    3. For a webserver-based app, you might also need to change the outgoing content-type, but I don't think that's necessary for PhoneGap.
  • edited October 2012
    Thanks for your response. Currently in the index.html page I have following metatag

    Is there any error in this tag? From the link you have shared I could see metatag

    for html5 format. I'm using html5 doctype but have metatag of HTML4 format. Does that cause this problem?
  • You can use the older-style meta tag in an html5 document (and vice-versa, often). I do notice that you've got "utf8" instead of "UTF-8" as the charset, but I would expect either to work.

    Reading your question again, are you saying that when you enter these characters into a text area from the keyboard, they're showing up as something else? That sounds more like a PhoneGap problem, in that case.

    I assume that text entry works properly in the *web browser* on this phone, right? What phone and OS platform are you building this for?
  • Thanks for your feedback. I am building an app targeted to work in Gingerbread, ICS. The issue I have is that I need to send these special characters in an ajax request. But while sending these characters in the request it turns to some other characters. That is my actual problem. When I searched it I got some suggestions like some encoding to be done, etc. But till now the error has not been resolved.
  • Hmm. The ajax request is going to go out in UTF-8 encoding by default, so you'd need to make sure that whatever server component is listening for it is using the same encoding. If the encoding on the server can't be changed to UTF-8, then I *think* you can override the content-type/charset on the request, which should change the outgoing encoding.

    Do you know which character encoding the server side is using? And can you check what's being received, to see which encoding is being sent?
  • shibinjohn009, I fixed your post. Please use the pre/code tags in your forum posts to surround code, including HTML.
Sign In or Register to comment.