Created
October 20, 2011 17:04
-
-
Save fengmk2/1301674 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> var b = new Buffer(2) | |
> b | |
<Buffer 00 00> | |
> b[0] = 0xcb | |
203 | |
> b | |
<Buffer cb 00> | |
> b[1] = 0xd5 | |
213 | |
> b | |
<Buffer cb d5> | |
> b.toString() | |
'��' | |
> var Iconv = require('iconv').Iconv; | |
> var iconv = new Iconv('gbk', 'utf-8') | |
> iconv | |
{} | |
> iconv.convert(b) | |
<SlowBuffer e8 8b 8f> | |
> iconv.convert(b).toString() | |
'苏' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment