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

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

轉載請注明來源 / 作者

?

tidy 試用

?

tidy 是一個把 HTML 標準化的工具,可以在 http://tidy.sourceforge.net/ 上下載

下了個 DOS 版本用了下,

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

-f 代表日志文件是 errs.txt ,如果沒有則創建, -m hy.htm 表示要進行標準化的文件,轉換后會覆蓋掉原來的 hy.htm ),

轉換后打開發現 hy.htm 中的漢字變成亂碼了, google search 了一下,呵呵,發現原來可以加個 config 文件配置編碼類型,把 config.txt 放在相應的目錄下,然后再次運行

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

(實際中遇到一個問題 -config config.txt 只能放在 -m hy.htm 之前 ,否則轉換后仍然是亂碼

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

// 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

?

?

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