123456789101112131415161718192021222324 |
- var encoding = require("encoding");
- // Convert with encoding.convert()
- // var resultBuffer = encoding.convert(text, toCharset, fromCharset);
- // Where
- // text is either a Buffer or a String to be converted
- // toCharset is the characterset to convert the string
- // fromCharset (optional, defaults to UTF-8) is the source charset
- // Output of the conversion is always a Buffer object.
- // Example
- var result = encoding.convert("̸»°Ó뺢×Ó -- Ìý","gb2312" ,"UTF-8");
- var r = result.toString();
- console.log(r); //<Buffer d5 c4 d6 dc>
- var chaine1 = "Äã ¶ú ¶ä ÌÛ Â𠡢ʹ Ÿ¢ ¶ù ÑÊ Œž Ï ¶ù ¡£";
|