Menu

#157 Improve Py3 MAPI string handling

Unstable (example)
closed-fixed
nobody
None
5
2016-02-27
2016-01-22
No

Any mapi module functions that use the TCHAR typemap create some interesting challenges.
In Py2, passing a unicode string require it to first be encoded as utf-16le as well as setting the MAPI_UNICODE flag. In Py3, you can only pass unicode strings (and also must still set MAPI_UNICODE).
While in Py2 this is a reasonable workaround, for Py3, some mapi functions simply will not work with unicode strings and will always fail with MAPI_E_BAD_CHARWIDTH.

Note, this patch has a dependency on [#156] for its PyWinObject_FromMAPIStr() function.

It also introduces a new helper function PyWinObject_AsMAPIStr() which should keep things backward compatible with the existing workaround for Py2 mentioned above.

The bulk of this patch is adding implementations for anything that uses a TCHAR typemap. Anything that is currently documented as a deprecated MAPI method was not changed. This includes everything in the exchange sdk module, as well as a few methods in the mapi module which were annotated with a Deprecated MAPI function comment.

1 Attachments

Related

Old Patches - new patches via https://github.com/mhammond/pywin32/pulls: #156

Discussion

  • Mark Hammond

    Mark Hammond - 2016-02-27
    • status: open --> closed-fixed
     
  • Mark Hammond

    Mark Hammond - 2016-02-27

    This looks like an improvement, thanks!

    4390:cc08f2559b15

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.