omegahat / RCurl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON which includes Unicode characters is broken

abicky opened this issue · comments

A JSON like below is broken when get the data using RCurl.

{"a":"\\\"\u0030\\\""}

I write a sample code as below:

> json <- getURL(dataUrl)
> cat(json, fill = TRUE)
{"a":"\\"0\\""}
> fromJSON(json)
Error in fromJSON(json) : unexpected character: 0

This is because \\ is converted to \ by R_mapString function, which is called only if the data includes Unicode character, so another JSON like below is never broken.

{"a":"\\\"0\\\""}

I'm sorry but I didn't know .mapUnicode argument.
I close this issue.