Subject: Re: specify charset for commits

From: Uwe Kleine-König <[email-masked]>
Date: Fri, 22 Dec 2006 23:02:04 +0100

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