Hey —

I want to cycle through a string that contains glyphs that are causing a UnicodeDecodeError:

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc4 in position 0: ordinal not in range(128)

What’s the best way to reference these in python? Do I need to convert them to unicode externally and then convert back when printing to the macro panel?

This wouldn’t convert either (ą = U+0105):

testuni = "U+0105"
test = testuni.decode(encoding=‘UTF-8’,errors=‘strict’)
print test

Any tips much appreciated.

The whole unicode handling in python 2 is just plain stupid. You need to memorise this page by hart: https://docs.python.org/2/howto/unicode.html

Did you try this?

testuni = u"\u0105"
print testuni

That did but I need to decode iteratively from a list.

I will park that in my read-when-patient folder! Thanks Georg. Glad to know I’m not the only one who finds it convoluted.