2016-05-27 91 views
2

我有一個返回數據的VB.Net Webservice是一個JSON字符串。返回的一些數據可能包含EMOJI。當我返回沒有EMOJI的數據時,數據恢復正常。JSON字符串被截斷當表情符號在數據中

這樣的 -

[ 
    { 
    "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" 
    } 
] 

如果蜇串在最後截止獲取數據有表情符號的任何地方。

表情符號在數據中的位置並不重要。

像 -

[ 
    { 
    "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" 

雖然你看不到表情符號在ImgDesc一塊?????代表表情符號。因此,ImgID 161的記錄已完成,但ImgID162的記錄截止於"Test Pics,"。如果我從ImgDesc中刪除表情符號,則數據恢復正常。

我正在與VB.NET和我有Newtonsoft.Json dll引用。

有什麼我需要做的emojis不會導致問題?

+1

看到http://stackoverflow.com/q/34139312/1070452 – Plutonix

+0

可能的問題包括:1)您正在下載使用錯誤的編碼JSON,如圖所示[點擊這裏](https://stackoverflow.com/questions/4716470)爲例。 2)JSON在發送端被錯誤編碼,例如[here](https://stackoverflow.com/q/34139312/1070452)所示。爲了更好地幫助我們,我們需要查看下載和反序列化JSON的代碼的[minimal,complete example](https://stackoverflow.com/help/mcve),以及完整的字節流或字符串你收到。 – dbc

回答