Search code examples
pythonasciiordinals

Get ASCII Int with ord() of German umlaute (ÄÜÖ) in python


Got some issues with ord() command and Unicode.

I want the decimal number of the entered ASCII letters.

For Example:

ord('ÄÖÜ') brings me these values: [195, 132, 195, 150, 195, 156]

  • [195,132] = Ä
  • [195,150] = Ö
  • [195,156] = Ü

This is what i want:

  • [196] = Ä
  • [214] = Ö
  • [220] = Ü

Any clues ?


Solution

  • This works for me:

    >>> [ord(i) for i in unicode('ÄÖÜ','utf-8')]
    [196, 214, 220]