2

I am putting some Japanese text in a div at run time but these characters are shown as boxes and triangles..

here is the head portion of my html page

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0">

and here is how I am putting text in div

if (getQSComponent(QSKeys.LangId) == 1) {
        $('#title').text("情報");
         $('#message').text("プロセスが正常に完了しました。");
            }
Cœur
  • 37,241
  • 25
  • 195
  • 267
AddyProg
  • 2,960
  • 13
  • 59
  • 110
  • 3
    charset=euc-jp ---- http://stackoverflow.com/questions/3598028/print-japanese-with-jquery does that work for you?despite utf-8 should be too. – briosheje Apr 01 '15 at 13:56
  • Worked for me [in jsfiddle](http://jsfiddle.net/amullins/qvgfkxjd/) with `charset=utf-8`. Maybe it's browser-specific? – Austin Mullins Apr 01 '15 at 13:58
  • From http://unicode.org/faq/han_cjk.html ::: _There is a lot of misinformation floating around about the support of Chinese, Japanese and Korean (CJK) characters. The Unicode Standard supports all of the CJK characters from JIS X 0208, JIS X 0212, JIS X 0221, or JIS X 0213, for example, and many more. This is true no matter which encoding form of Unicode is used: UTF-8, UTF-16, or UTF-32._ .... So yeah, it should be working with UTF-8, unless it is printed outside of the DOM or it is browser specific as Austin pointed out..! Strange stuff. wait. When are you executing this script? – briosheje Apr 01 '15 at 14:00
  • @briosheje : I think it browser specific because it works fine on PC browser but in iOS webview it dont show JP characters...I am executing this script in document.ready – AddyProg Apr 01 '15 at 14:04
  • Oh, then take a look at this: http://stackoverflow.com/questions/19484325/special-characters-utf8-not-displaying-in-safari ... Are you using safari? – briosheje Apr 01 '15 at 14:06
  • I am loading this page in iOS 8’s WKWebView... – AddyProg Apr 01 '15 at 14:10
  • [see here](http://stackoverflow.com/questions/11476014/japanese-and-chinese-characters-in-ios) – alessandrio Apr 01 '15 at 14:15

1 Answers1

0
<script charset="euc-jp" src="jp.js"></script>

or

<script charset="euc-jp">
if (getQSComponent(QSKeys.LangId) == 1) {
    $('#title').text("情報");
    $('#message').text("プロセスが正常に完了しました。");
}
</script>

--
in tag <meta>, simply with this :

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
alessandrio
  • 4,282
  • 2
  • 29
  • 40