githelper.git / githelper.pike

version» Context lines:

githelper.git/githelper.pike:158:   {    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) +  // Pike 8.0 and later.    Charset.Decoder decoder = Charset.decoder(encoding); - #else + #elif constant(Locale.Charset.Decoder) +  // Pike 7.8.    Locale.Charset.Decoder decoder = Locale.Charset.decoder(encoding); -  + #else +  // Pike 7.4 +  object 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;