/** * Given a file name, determine if the file contents make it an ascii file * * @param string $name name of file * * @return boolean true if file is ascii * @access public */ static function isAscii($name) { $fd = fopen($name, "r"); if (!$fd) { return false; } $ascii = true; while (!feof($fd)) { $line = fgets($fd, 8192); if (!CRM_Utils_String::isAscii($line)) { $ascii = false; break; } } fclose($fd); return $ascii; }
/** * Given a file name, determine if the file contents make it an ascii file * * @param string $name * Name of file. * * @return bool * true if file is ascii */ public static function isAscii($name) { $fd = fopen($name, "r"); if (!$fd) { return FALSE; } $ascii = TRUE; while (!feof($fd)) { $line = fgets($fd, 8192); if (!CRM_Utils_String::isAscii($line)) { $ascii = FALSE; break; } } fclose($fd); return $ascii; }