开发者

How to convert verbatim string to regular unicode

I'm pro-grammatically reading emails from Exchange 2010 that have been sent in plain text. In my parsing tests to ensure the email is valid I do a series of validations, one being checking the beginning text (StartsWith precisely). When I manually copy and paste the email from Exchange into Visual Studio 2008 the st开发者_Go百科art of the email looks like \r\n \x0002\r\n. I believe \x0002 is a smiley face (STX) judging from my research. However, programatically retrieving the email from Exchange as well as viewing it in Outlook the \x0002 character displays as a . Ideally, I would like to parse what's retrieved from Exchange (\r\n ㅁ\r\n) and convert it to \r\n \x0002\r\n.

For what it's worth, ReSharper is the one who converted the original string to include \x0002.

Is this possible?


It sounds like you want one of the following:

Encoding.Unicode.GetBytes(myString);
Encoding.Unicode.GetChars(myString);

To format a char or a byte as a unicode character (e.g. "\uFF66" or "\x0002") see the following question:

Converting Unicode strings to escaped ascii string

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜