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

 

 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章