zoukankan      html  css  js  c++  java
  • phantomjs 抓取、截图中文网站乱码的问题的解决

    用phantomjs抓取html乱码的解决方案:

    phantomjs --output-encoding=gbk test.js http://webscan.360.cn/index/checkwebsite?url=www.coding123.net

    https://blog.csdn.net/kaosini/article/details/47252457

    这两个参数可以指定编码 ...

    --output-encoding=encoding sets the encoding used for terminal output (default is utf8).
    --script-encoding=encoding sets the encoding used for the starting script (default is utf8).

    设置成 GBK 就可以了 ...

    或者

    phantom.outputEncoding="gbk";

    用phantomjs截图时中文乱码的解决方案:

    用phantomjs去截取中文页面的网站可能会出现乱码的情况,也就是截图中中文的位置全是方框。
    解决办法就是安装字体。
    在centos中执行:yum install bitmap-fonts bitmap-fonts-cjk
    在ubuntu中执行:sudo apt-get install xfonts-wqy
    这样再去截图中文的页面就不会出现一堆的方框了。
  • 相关阅读:
    Maven项目类型和JAVASE项目和JAVAEE项目的关系
    使用faker 生成测试数据
    python 面向对象
    python csv读写
    分治
    django 部署
    js 时间格式转换
    python环境
    枚举
    递归
  • 原文地址:https://www.cnblogs.com/shenwenkai/p/9213312.html
Copyright © 2011-2022 走看看