githelper.git / githelper.pike

version» Context lines:

githelper.git/githelper.pike:143:   int is_encoding_utf8(string name)   {    return (!name) || (<"utf-8", "utf8">)[lower_case(name)];   }      string check_encoding(string data, string|void encoding)   {    if(is_encoding_utf8(encoding))    encoding = "UTF-8";    mixed err = catch { +  #if constant(Charset) +  Charset.Decoder decoder = Charset.decoder(encoding); +  #else    Locale.Charset.Decoder decoder = Locale.Charset.decoder(encoding); -  +  #endif    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: