word存的html中的unicode中文转码为标准中文
var fs = require("fs");
fs.readFile("page.htm",function(err,data){
var str = data.toString();
var matchs = str.match(/&#[0-9]{5};/gm);
for(var i = 0 ; i < matchs.length ; i++){
var ma = matchs[i];
var a = ma.replace("&#","").replace(";","");
a = parseInt(a).toString(16);
console.log(unescape('%u'+a));
str = str.replace(ma,unescape("%u"+a));
}
fs.writeFile("out.htm",str,function(){
console.log("写入成功");
})
console.log(matchs.length,matchs[0]);
}) 相关推荐
zrtlin 2020-11-09
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17