1

I have some html to convert by jtidy, which contains some Chinese characters:

<font>怎么回事</font>

But the result looks like:

<font>&aelig;&#128;&#142;&auml;&sup1;&#136;&aring;&#155;&#158;&auml;&ordm;&#139;</font>

How to configure jtidy and let it not convert Chinese characters into html entities?

Makoto
  • 104,088
  • 27
  • 192
  • 230
Freewind
  • 193,756
  • 157
  • 432
  • 708

2 Answers2

0
    tidy.setInputEncoding("utf-8");
    tidy.setOutputEncoding("utf-8");

Or what encoding your input and your output are.

cherouvim
  • 31,725
  • 15
  • 104
  • 153
-1

see this

http://www.pinyin.info/tools/converter/chars2uninumbers.html

this is the function to convert chinese chars to unicode numbers

function convertToEntities() {
  var tstr = document.form.unicode.value;
  var bstr = '';
  for(i=0; i<tstr.length; i++) {
    if(tstr.charCodeAt(i)>127) {
      bstr += '&#' + tstr.charCodeAt(i) + ';';
    } else {
      bstr += tstr.charAt(i);
    }
  }
  document.form.entity.value = bstr;
}
Florent
  • 12,310
  • 10
  • 49
  • 58