joyent/node — Issue #2686: 4 byte unicode troubles
Author: bobrik
Created: 2012-02-03 08:38:25+00:00
State: open

I have a buffer named test ``

In hex: `2274657874223a22f09f988322`

When I try to slice in to get 4 bytes (apple emoji):

```
> test.slice(8, 12)

> test.slice(8, 12).toString()
'?'
```

But when I try to create buffer from the same thing:

```
> new Buffer(test.slice(8, 12).toString())

```

Whoa, that's not what I meant!

The whole story: I get JSON string from iPhone client to my app with emoji in text, call `JSON.parse()` on it, do what I need to do and send message to another iPhone where emoji becomes corrupted. I haven't found any solution to escape unicode text with `\uxxxx` on JSON.parse so here we are.