所有:
我想使用EWS发送创建日历项操作请求,并且我的一些内容(例如Subject)可能会包含中文字符。 这是我的请求肥皂的样子
<?xml version="1.0" encoding="utf-8"?> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header> <RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/> </Header> <Body> <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" SendMeetingInvitations="SendToNone"> <SavedItemFolderId> <DistinguishedFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Id="calendar"/> </SavedItemFolderId> <Items> <CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> <Subject>新建日程</Subject> <ReminderIsSet>true</ReminderIsSet> <ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart> <Start>2016-06-22T09:00:00</Start> <End>2016-06-22T10:00:00</End> </CalendarItem> </Items> </CreateItem> </Body> </Envelope>我用utf-8编码这个xml,并将它发送到我的测试交换服务器,过了一段时间后,它显示在该服务器上,但在主题属性中使用问号而不是“新建日程”。 所有其他属性都正确显示。
所以我想知道我错在哪里,中文内容无法正确显示。 有什么建议么?
all:
I want to send creating calendar item operation request using EWS, and some of my content, for instance, Subject, may content Chinese characters. Here is what my request soap looks like
<?xml version="1.0" encoding="utf-8"?> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header> <RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/> </Header> <Body> <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" SendMeetingInvitations="SendToNone"> <SavedItemFolderId> <DistinguishedFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Id="calendar"/> </SavedItemFolderId> <Items> <CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> <Subject>新建日程</Subject> <ReminderIsSet>true</ReminderIsSet> <ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart> <Start>2016-06-22T09:00:00</Start> <End>2016-06-22T10:00:00</End> </CalendarItem> </Items> </CreateItem> </Body> </Envelope>I encode this xml with utf-8 and send it to my testing exchange server, and after a while, it displayed on that server, but with question mark in Subject property instead of '新建日程'. All other properties are displayed correctly.
So I wonder where I did wrong that the Chinese content can not be displayed correctly. Any suggestions?
最满意答案
最后,我找出了什么是错的。 它在请求标题中。 我发现头文件忘记将charset设置为utf-8。 多么简单但愚蠢的错误.....
Finally, I figure out what's wrong. It's in the request header. I found that the header forgot to set charset as utf-8. What a simple but stupid mistake.....
更多推荐
发布评论