Module request how to properly retrieve accented characters? � � �

前端 未结 3 444
孤城傲影
孤城傲影 2020-12-01 12:25

I\'m using: Module: Request -- Simplified HTTP request method to scrape a webpage with accented characters á é ó ú ê ã etc.

I\'ve already tried e

3条回答
  •  盖世英雄少女心
    2020-12-01 13:00

    Specify the encoding as utf8 not utf-8. Here are a list of possible encodings for a buffer from the Node.js documentation.

    • ascii - for 7 bit ASCII data only. This encoding method is very fast, and will strip the high bit if set.
    • utf8 - Unicode characters. Many web pages and other document formats use UTF-8.
    • base64 - Base64 string encoding.
    • 'binary - A way of encoding raw binary data into strings by using only the first 8 bits of each character. This encoding method is depreciated and should be avoided in favor of Buffer objects where possible. This encoding will be removed in future versions of Node.

提交回复
热议问题