-1

I have a custom file which stores a list of German umlauts ("ä" "ö" ) My program needs to read these letters and print an ascii value.

I have tried this

key = (WORD) VkKeyScanEx((TCHAR) szLetterName[0], ::GetKeyboardLayout(0));

This piece of code always returns 65535 for all the german letters but gives a proper value for English Alphabets.

Any idea why this issue is coming. Any suggestions to fix this issue ??

hivert
  • 10,579
  • 3
  • 31
  • 56
Rajasekhar
  • 19
  • 3
  • 4
    Ugh, no, you are reading a text file. Not a keyboard. If you are lucky, this file is encoded with one of the Unicode encodings, like utf-8. And has a BOM that indicates which encoding is used. Unicode is not something that the C++ standard tries to tackle, you need a library. – Hans Passant Feb 03 '14 at 13:56

1 Answers1

1

There is no ASCII values for those character (see eg the ASCII table in http://fr.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange). Therefore you must use a different encoding (latin/UTF). Note that some of these encoding use multi-byte characters.

hivert
  • 10,579
  • 3
  • 31
  • 56