本文介绍了MSExchange URL编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写PHP服务以通过WebDAV查询Exchange服务器.这项服务已经使用了大约一个月,而且没有出现任何问题,但是今天,当一封包含以下主题行的电子邮件到达邮箱时,却遇到了麻烦:

I am writing a PHP service to query an Exchange server via WebDAV. This service has been live for roughly a month with no issues, but experienced a hiccup today when an email with the following subject line arrived in the mailbox:

该消息存储在文件"FW:每日批准报告:供应商/主007297.EML"中,并通过url引用为:

The message is stored in the file "FW: Daily Approval Report: Vendor/Master 007297.EML" and is referenced through a url as:

FW:%20Daily%20Approval%20Report:%20Vendor_xF8FF_Master%20007297.EML

我一直在使用PHP rawurlencode()函数将消息文件名转换为对应的URL,但是在这种情况下,rawurlencode()返回不匹配的字符串:

I had been using the PHP rawurlencode() function to translate the message filename to its URL counterpart, but in this case rawurlencode() returns a mismatched string:

FW%3A%20Daily%20Approval%20Report%3A%20Vendor%2FMaster%20007297.EML

我不是Exchange专家,也不知道如何匹配其编码.有人可以告诉我是否存在可以用来编写自己的函数的映射吗?我认为简单地将/替换为\_xF8FF\_并跳过冒号将导致从现在开始一个月后再次追查该错误,但是Google并没有帮助生成完整的异常列表.

I'm no guru with Exchange and do not know how to match it's encoding. Can someone tell me if there is a mapping I can use to write my own function? I assume simply replacing / with \_xF8FF\_ and skipping colons will lead to chasing down this error again a month from now, but Google hasn't been helpful producing a full list of exceptions.

推荐答案

我已经在Google上进行了一些搜索,但是找不到所需字符的完整参考.
我发现的唯一一件事是,以下五个字符在Exchange中具有特殊的编码:

I've googled around a bit, but I haven't been able to find the complete reference of characters that you're looking for.
The only thing that I've discovered is that the following five characters have a special encoding in Exchange:

  • 正斜杠'/'编码为_xF8FF _
  • 问号?"编码为_x003F _
  • 反斜杠'\'编码为_xF8FE _
  • 波浪号'〜'编码为_x007E _
  • 欧元符号€"的编码为_x0080 _

看看 Ximian Connector for Microsoft Exchange的源代码,更确切地说,位于" e2k_uri_append_encoded "函数,在第280行.
通过通过WebDAV协议与Microsoft Exchange服务器通信,Ximian连接器使Ximian Evolution可以用作Microsoft Exchange客户端,因此它必须完全解决您遇到的相同问题.

Maybe it could help to have a look at the source of the Ximian Connector for Microsoft Exchange, and more precisely at the "e2k_uri_append_encoded" function, at line 280.
The Ximian Connector enables Ximian Evolution to function as a Microsoft Exchange client by communicating with Microsoft Exchange servers through the WebDAV protocol, so it has to deal exactly with the same problem you have encountered.

这篇关于MSExchange URL编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 14:30