def generator(): n = 0 for cp in range(0, 0x110000): try: ch = chr(cp) ch.encode('utf-8') except UnicodeEncodeError: continue if not GLib.unichar_isdefined(ch): continue elif GLib.unichar_iszerowidth(ch): yield (cp - n, tohex(cp), 0) elif GLib.unichar_iswide(ch): yield (cp - n, tohex(cp), 2) else: try: if fMig[cp].width == widths[1]: yield (cp - n, tohex(cp), 2) else: continue except: continue n += 1