Python code to get the typed text in a tab

In the case of certain Latin diacritics and also letters from the Cyrillic and Greek alphabets, the “Font.currentText” line gets them written as descriptive names – see the attached image.

This is a problem if I want to do a change case script. How can I get the text as “normal” text, so the change case routines work for all alphabets?

Here’s the script I’m trying to run on a text like “ελληνικά АаБбВвГгДдЕ ȘșȚț”:

#MenuTitle: Change case

-- coding: utf-8 --

Changes case of the selected text.

import GlyphsApp
import re

Font = Glyphs.font

currentText = Font.currentText
selectedLayers = Font.selectedLayers
Ucase = currentText.decode(‘utf-8’).upper()

Message(“Upper case”, Ucase)

For changing case of selected text, I use this: