简体   繁体   中英

C++ DLL special characters

I'm sending an user-generated string from my program into a C++ DLL function I'm making. It works fine, until I send a string like "åäö". My function looks something like this:

export void showMessage(char* str) {
    MessageBox(NULL, str, "DLL says", MB_OK);
}

When "åäö" is sent from the program, a message with "åäö" popups up. How do I convert it into "åäö"? What library is needed? I'm using Code::Blocks for the DLL.

The characters you are using appear to be in the extended ASCII table (value greater than 127), and will depend on the code page you are using, which is a less than portable approach, since the system running your code needs to make environment changes outside of the program itself.

Instead of using MessageBox , use the Unicode enabled version, MessageBoxW , and look up the Unicode encodings for the characters you specified.

References


  1. Unicode Versions and ANSI Versions of Functions , Accessed 2014-06-06, <http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcodeconcepts/unicode_ansi_version_functs/>
  2. ASCII Table Lookup , Accessed 2014-06-06, <http://www.theasciicode.com.ar/extended-ascii-code/capital-letter-a-ring-uppercase-ascii-code-143.html>
  3. Unicode Lookup , Accessed 2014-06-06, <http://unicodelookup.com/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM