diff --git a/lib/class.RegisterUtils.php b/lib/class.RegisterUtils.php index b3b6c8268ea39261cb3b66a5ee92e80cdfc59903..34de2932b73d4f19b8726bb55eae0ea69827a731 100644 --- a/lib/class.RegisterUtils.php +++ b/lib/class.RegisterUtils.php @@ -15,9 +15,14 @@ class RegisterUtils { private $mandatory = array(); private $optional = array(); public $values = array(); - - function __construct($directory = NULL) { + private static function toASCII($data) { + $ss = utf8_decode($data); + $s = iconv("LATIN1", "ASCII//TRANSLIT", $ss); + return $s; + } + + function __construct($directory = NULL) { clearstatcache(); $this->errorString=''; if (!$directory) { @@ -97,8 +102,10 @@ class RegisterUtils { } public function saveRegistration() { - $last = $this->mandatory{'last'}; - $first = $this->mandatory{'first'}; + $last = self::toASCII($this->mandatory{'last'}); + $last = strtr($last, ' ','_'); + $first = self::toASCII($this->mandatory{'first'}); + $first = strtr($first, ' ','_'); $date = substr(date(DateTime::ISO8601),0,-5); $filename = $this->directory.'/'.$last . '_' . $first . '_' . $date; $contents = ''; @@ -171,7 +178,7 @@ class RegisterUtils { foreach ($allKeys as $key) { $value = str_replace($dquot,$ddquot,$values[$key]); $value = sprintf('"%s"',$value); - $fields[] = $value; + $fields[] = utf8_decode($value); } $outLine = join(';',$fields).PHP_EOL; fwrite($outFile,$outLine);