我有json feed可以在这里看到
http://www.ticketfly.com/api/events/upcoming.json?orgId=1&pageNum=1&fieldGroup=light&fields=dateCreated,featured,published,publishDate,image,onSaleDate,offSaleDate,promoterName,sponsorName,sponsorImage,additionalInfo,showTypeCode,showType,externalTicketingUrls,facebookEventId,isMobileFriendly,isMobileFriendlyBoolean,headliners.id,headliners.name,headliners.startTime,headliners.eventDescription,headliners.urlOfficialWebsite,headliners.urlMySpace,headliners.urlFacebook,headliners.urlTwitter,headliners.urlAudio,headliners.urlPurchaseMusic,headliners.embedAudio,headliners.embedVideo,headliners.image.original,headliners.image.xlarge,headliners.image.large,headliners.image.medium,headliners.image.small,headliners.image.xlarge1,headliners.image.large1,headliners.image.medium1,headliners.image.small1,headliners.image.square,headliners.image.squareSmall,supports.id,supports.name,supports.startTime,supports.eventDescription,supports.urlOfficialWebsite,supports.urlMySpace,supports.urlFacebook,supports.urlTwitter,supports.urlAudio,supports.urlPurchaseMusic,supports.embedAudio,supports.embedVideo,supports.image.original,supports.image.xlarge,supports.image.large,supports.image.medium,supports.image.small,supports.image.xlarge1,supports.image.large1,supports.image.medium1,supports.image.small1,supports.image.square,supports.image.squareSmall,org.id,org.name,org.timeZone,org.promoter,venue.timeZone,venue.address1,venue.address2,venue.city,venue.stateProvince,venue.postalCode,venue.metroCode,venue.country,venue.url,venue.blurb,venue.urlFacebook,venue.urlTwitter,venue.lat,venue.lng,venue.image,urlEventDetailsUrl
我正在使用网络客户端下载它
var json= client.DownloadString(uri);
结果几乎和预期的一样,但它改变了一些字符串格式,就好像响应中的属性具有某些使用特殊字符的值
eventDescription: "TUM is Canada’s first and only social food market designed to give budding food entrepreneurs, chefs and home cooks a platform to test new food ideas to an eager market. Since September 2011, each TUM event has featured new cooks & chefs wanting to exhibit their food plus various local craft beer, wine & cocktails.",
将其更改为
eventDescription: "TUM is Canada’s first and only social food market designed to"
我想和回应一样。有什么建议吗?
答案 0 :(得分:6)
您必须在调用DownloadString()
之前设置文本编码。
client.Encoding = Encoding.UTF8;
要确定要使用的编码,请检查服务的Content-Type
响应标头。
内容类型:应用/ JSON;字符集= UTF-8