2

I have a VB.Net Webservice that returns data is a JSON string. Some of the data returned might have an EMOJI in it. When I return data that does not have an EMOJI in it the data come back fine.

Like this -

[
  {
    "ImgID": "150",
    "ImgDesc": "Added to your portfolio",
    "PublicID": "c0lbquvzitd3igohfh7x",
    "ImgURL": "test.com",
    "LikeCount": "0",
    "CommentCnt": "2",
    "PickCount": "",
    "ServerUpdateDate": "1\/17\/2016 3:13:21 PM",
    "UserName": "Deathstarspa",
    "ProfileImgID": "hqhoiohfckzldgpdem6k",
    "Location": "Chester County, PA, USA",
    "dltflg": "False",
    "PortName": "2 0 1 6 | M E N S",
    "Categories": "Blowouts"
  },
  {
    "ImgID": "151",
    "ImgDesc": "Stone cold",
    "PublicID": "udecff1bi0ymhewp1qlv",
    "ImgURL": "Test.com",
    "LikeCount": "0",
    "CommentCnt": "0",
    "PickCount": "",
    "ServerUpdateDate": "1\/17\/2016 3:17:26 PM",
    "UserName": "Deathstarspa",
    "ProfileImgID": "hqhoiohfckzldgpdem6k",
    "Location": "Chester County, PA, USA",
    "dltflg": "False",
    "PortName": "2 0 1 6 | M E N S",
    "Categories": "Test"
  }
]

If the data has an emoji anywhere in the sting the string gets cutoff at the very end.

It does not matter where the emoji is in the data.

Like -

[
  {
    "ImgID": "161",
    "ImgDesc": "Bed ?????",
    "PublicID": "gnw6ooo04ls21kqq8doo",
    "ImgURL": "test.com",
    "LikeCount": "0",
    "CommentCnt": "0",
    "PickCount": "",
    "ServerUpdateDate": "2\/11\/2016 8:18:03 PM",
    "UserName": "Deathstarspa",
    "ProfileImgID": "hqhoiohfckzldgpdem6k",
    "Location": "Chester County, PA, USA",
    "dltflg": "False",
    "PortName": "Bed Pics",
    "Categories": "Blowouts,Treatments"
  },
  {
    "ImgID": "162",
    "ImgDesc": "Bed ?????",
    "PublicID": "lrdxpvwxoq5zxpkagamo",
    "ImgURL": "test.com",
    "LikeCount": "0",
    "CommentCnt": "0",
    "PickCount": "",
    "ServerUpdateDate": "2\/11\/2016 8:18:05 PM",
    "UserName": "Deathstarspa",
    "ProfileImgID": "hqhoiohfckzldgpdem6k",
    "Location": "Chester County, PA, USA",
    "dltflg": "False",
    "PortName": "Test Pics"

Although you cannot see the Emojis in the ImgDesc piece the ????? represent the emoji. So the record with ImgID 161 is complete, but the record with ImgID of 162 get cutoff at "Test Pics,". If I remove the emoji from the ImgDesc then the data come back fine.

I am working with VB.NET and I have the Newtonsoft.Json dll referenced.

Is there something I need to do so the emojis do not cause issues?

Shiva
  • 20,575
  • 14
  • 82
  • 112
Dwight
  • 93
  • 1
  • 9
  • 1
    see http://stackoverflow.com/q/34139312/1070452 – Ňɏssa Pøngjǣrdenlarp May 27 '16 at 14:01
  • Possible problems include: 1) You are downloading the JSON using the wrong encoding, as is shown [here](https://stackoverflow.com/questions/4716470) for example. 2) The JSON is wrongly encoded on the sending side, as shown [here](https://stackoverflow.com/q/34139312/1070452) for example. For us to help more, we would need to see a [minimal, complete example](https://stackoverflow.com/help/mcve) of the code where you download and deserialize the JSON, and the complete byte stream or string that you receive. – dbc May 29 '16 at 02:33

1 Answers1

3

You will need to properly encode the emoji, per the JSON standard. See the related answer below:

how can I Deserialize emoji in json in C#

Community
  • 1
  • 1
Nick Heidke
  • 2,787
  • 2
  • 34
  • 58