charset
Get the content charset from header and html content-type.
Install
$ npm install charset --save
Usage
Detect charset from http client response and content
var charset = ;var http = ; http;
Stdout will should log: utf8
.
Detect from String
;
jschardet
Detect combine withAs you know, charset
only detect from http response headers and html content-type meta tag.
You can combine with jschardet to help you detect the finally charset.
This example codes come from stackoverflow#12326688:
var request = ;var charset = ;var jschardet = ; ;