Branch: Tag:

2010-10-03

2010-10-03 12:02:13 by Marcus Comstedt <marcus@mc.pp.se>

Check also for weird control characters in recoded commit message.

123:    encoding = "UTF-8";    mixed err = catch {    Locale.Charset.Decoder decoder = Locale.Charset.decoder(encoding); -  if(search(decoder->feed(data)->drain(), "\ufffd")>=0) +  foreach(Array.uniq(values(decoder->feed(data)->drain())), int c) +  switch(c) { +  case 0xfffd:    return "Undefinied character detected\n"; -  +  case '\t': +  case '\n': +  case '\r': /* ? */ +  /* Allowed control character */ +  break; +  default: +  if (c<32 || (c>=0x80 && c<0xa0)) +  return sprintf("Forbidden control character 0x%02x detected\n", c); +  }    };    return err && err[0];   }