简体   繁体   中英

Jtidy - Shouldn't display encoding character(<sup>&acirc;&#132;&cent;) for TM in page source code?

I'm using Jtidy to rendor news information, when news information has TM in it then page source is showing it as

'â??¢' which is invalid...

Here is my code:

InputStream is = new ByteArrayInputStream(description.getBytes()); OutputStream os=new ByteArrayOutputStream();

    Tidy tidy = new Tidy(); 

    tidy.setPrintBodyOnly(true);
    //tidy.setEscapeCdata(true);
    //tidy.setAsciiChars(false);

Any idea how to display TM in place of this encoding characters.... or how to set (ISO-8859-1) to Tidy?

There is a HTML entity for this, not too surprisingly called &trade; - see eg http://www.w3.org/TR/WD-entities-961125

通过在Tidy上设置setInputEncoding()和setOutputEncoding()来解决此问题...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM