Deprecate and replace incorrect Windows code page conversion API wrapper methods
Reason for change
The following methods wrapping Windows code page conversion API calls use incorrect signatures for the Windows API calls:
• multiByteToWideChar:
dwFlags:
lpMultiByteStr:
cchMultiByte:
lpWideCharStr:
cchWideChar:
• wideCharToMultiByte:
dwFlags:
lpWideCharStr:
cchWideChar:
lpMultiByteStr:
cchMultiByte:
lpDefaultChar:
lpUsedDefaultChar:
The error is that cchMultiByte: should be cbMultiByte: to indicate that the argument is a count of the number of bytes in the multibyte buffer, not a count of characters.
Change
New corrected methods wrapping the Windows API calls are provided:
• multiByteToWideChar:
dwFlags:
lpMultiByteStr:
cbMultiByte:
lpWideCharStr:
cchWideChar:
• wideCharToMultiByte:
dwFlags:lpWideCharStr:
cchWideChar:
lpMultiByteStr:
cbMultiByte:
lpDefaultChar:
lpUsedDefaultChar:
The original methods are deprecated and categorized as PI-Obsolete.
Action required
If your application invokes either of the deprecated methods, you should change to use the replacement methods. You should also verify that you are supplying a count of bytes, not characters, for the cbMultiByte: argument to the methods.
Last modified date: 06/19/2020