2 Replies Latest reply: Apr 8, 2013 10:23 PM by user12956197 RSS

    webview display wrong encoding

    user12956197
      I am embedding baidu map to my application. but Chinese characters of the page can't be properly displayed due to wrong encoding
      http://map.baidu.com/su?wd=a&cid=131&type=0&newmap=1&b=%2812946955.78,4845405.2;12947971.78,4845512.2%29&t=1365266007635
      for many browser like ie or chrome, user can manully select encoding, how can I do this in webview?
        • 1. Re: webview display wrong encoding
          peterz
          Currently there's no API for that.
          You may try, with HTTP headers or GET parameters or whatever, to get the server report correct encoding for you.
          • 2. Re: webview display wrong encoding
            user12956197
            http://map.baidu.com/
            this page is encoded by utf-8 <meta charset="utf-8" />
            but when type something in the textbox, it's a ajax recall. http://map.baidu.com/su?wd=ab&cid=131&type=0&newmap=1&b=%2812915600.97,4825427.72;13000720.97,4850323.72%29&t=1365477546776
            which return a json object. it's encoded also by utf-8.
            but I paste this url in firefox or chrome. it's wrongly displayed. I have to manully select utf-8 and it's correct.
            as far as I know, mainstream browser such as ie, ff and chrome have the ability to "detect charset/encoding".
            I guess if the encoding is not specified explicityly, javafx webview will use system's default encoding. I am in windows 7, so it use gbk for Chinese. so it's wrong.