No unicode != no unicode

Hi all,

I’m on my way to write and test a script.
I have to know wether a Glyph has a Unicode or not.
By accident I discovered that my branch does not catch every option:

GLYPHS:

Let me say there are two Glyphs:
One is the infamous ‘.notdef’ and
the other is just a non-standard Glyph (f.e. with a name ‘Test’ (so got no unicode)).

SNIPPED:

for thisLayer in Glyphs.font.selectedLayers:
thisGlyph = thisLayer.parent

if thisGlyph.unicode != None:
	print 'some unicode: |',thisGlyph.unicode,'| in ',thisGlyph.name
else:
	print 'no unicode: |',thisGlyph.unicode,'| in ',thisGlyph.name
	
if thisGlyph.unicode == '':
	print "seems to be a string?\n"

RESULT:
some unicode: | | in .notdef
seems to be a string?

no unicode: | None | in Test

There seems to be a difference between unicode -> None and Unicode -> ‘’?
But why? it is sufficient to add ‘if no string’ to the branch or is there a better way?

Thx

add:

for sure, the .notdef has not really a unicode!?

You always have to check for the length of the unicode string. just checking .unicode is not nil is not enough.

ok I will use more ‘len’ to check and take care of this. thank you