版權(quán)所有: (xiaodaoxiaodao) 藍(lán)小刀 ?? xiaodaoxiaodao@gmail.com

http://m.tkk7.com/xiaodaoxiaodao/articles/103444.html

轉(zhuǎn)載請(qǐng)注明來(lái)源 / 作者

?

tidy 試用

?

tidy 是一個(gè)把 HTML 標(biāo)準(zhǔn)化的工具,可以在 http://tidy.sourceforge.net/ 上下載

下了個(gè) DOS 版本用了下,

在命令行輸入 tidy -f errs.txt -m hy.htm

-f 代表日志文件是 errs.txt ,如果沒(méi)有則創(chuàng)建, -m hy.htm 表示要進(jìn)行標(biāo)準(zhǔn)化的文件,轉(zhuǎn)換后會(huì)覆蓋掉原來(lái)的 hy.htm ),

轉(zhuǎn)換后打開(kāi)發(fā)現(xiàn) hy.htm 中的漢字變成亂碼了, google search 了一下,呵呵,發(fā)現(xiàn)原來(lái)可以加個(gè) config 文件配置編碼類(lèi)型,把 config.txt 放在相應(yīng)的目錄下,然后再次運(yùn)行

tidy -f errs.txt -config config.txt -m hy.htm ,用 IE 打開(kāi)后中文正確顯示

(實(shí)際中遇到一個(gè)問(wèn)題 -config config.txt 只能放在 -m hy.htm 之前 ,否則轉(zhuǎn)換后仍然是亂碼

下面是從 http://tidy.sourceforge.net/docs/quickref.html 下載的 config.txt ,把 char-encoding: latin1 改成 char-encoding: raw 就可解決亂碼問(wèn)題

// sample config file for HTML tidy

indent: auto

indent-spaces: 2

wrap: 72

markup: yes

output-xml: no

input-xml: no

show-warnings: yes

numeric-entities: yes

quote-marks: yes

quote-nbsp: yes

quote-ampersand: no

break-before-br: no

uppercase-tags: no

uppercase-attributes: no

char-encoding: latin1

new-inline-tags: cfif, cfelse, math, mroot,

? ?mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,

? ?munder, mover, mmultiscripts, msup, msub, mtext,

? ?mprescripts, mtable, mtr, mtd, mth

new-blocklevel-tags: cfoutput, cfquery

new-empty-tags: cfelse

?

?

? 版權(quán)所有: (xiaodaoxiaodao) 藍(lán)小刀 ?? xiaodaoxiaodao@gmail.com