Character Encoding

Character Encoding

I have a test application that uses UNICODE. I cannot use AdpException::GetMessage() because of character encoding. Most if not all new applications use UNICODE. However, the AdpException still use "char" instead of "wchar_t" or "TCHAR (on Windows)". I recommend to add support for UNICODE.
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

A very good suggestion

I believe there are many updates and fixes planned for the SDK. In the meantime we must make do and create handlers for these types of situations. Great feedback.

With the latest release of the SDK, AdpException has had it's methods changed to AdpException::message(), AdpException::code(), etc., to match the existing exception interface. One issue with AdpException, however, is that its constructor still requires a const char* to initialize the object. Since exceptions are not ideally meant to provide end-users with messages, this was not regarded as a critical issue. To mitigate this, we've supplied cout and wcout operator overloads to enable output to either format without requiring additional processing. I would imagine that future releases will include constructors supporting both character formats, or perhaps even refactoring std::exception out of the inheritance hierarchy, and moving to a code base that supports only wide characters.

Thanks for the info Julian. Would be great to see that change in the final build.

You can use MultiByteToWideChar to convert char string to unicode (wchar) string

TCHAR szBuffer[1024] = {0};
MultiByteToWideChar(CP_ACP, 0, lpszCharString, -1, szBuffer, _countof(szBuffer) - 1);

Leave a Comment

Please sign in to add a comment. Not a member? Join today