Hello, Uwe Kleine-König wrote: > def is_utf8_str(s): > cnt_furtherbytes = 0 > for c in s: > if cnt_furtherbytes > 0: > if ord(c) & 0xc0 == 0x80: > cnt_furtherbytes -= 1 > else: > return False > else: > if ord(c) < 0x80: > continue > elif ord(c) < 0xc0: > return False > elif ord(c) < 0xe0: > cnt_furtherbytes = 1 > elif ord(c) < 0xf0: > cnt_furtherbytes = 2 > elif ord(c) < 0xf8: > cnt_furtherbytes = 3 > elif ord(c) < 0xfc: > cnt_furtherbytes = 4 > elif ord(c) < 0xfe: > cnt_furtherbytes = 5 > else: > return False > return True While I washed the dishes I noticed that the last "return True" should be "return cnt_furtherbytes == 0". Just before someone else corrects me ... :-) Best regards Uwe -- Uwe Kleine-König http://www.google.com/search?q=parsec%5E2*Joule%2FNewton+in+tablespoon - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html