Skip to content
Snippets Groups Projects
Commit 1fe1b90b authored by Leif Andersson's avatar Leif Andersson
Browse files

Konverterade UTF8 till Latin1 eller ascii

parent eab60a4d
Branches
No related tags found
No related merge requests found
...@@ -16,6 +16,11 @@ class RegisterUtils { ...@@ -16,6 +16,11 @@ class RegisterUtils {
private $optional = array(); private $optional = array();
public $values = array(); public $values = array();
private static function toASCII($data) {
$ss = utf8_decode($data);
$s = iconv("LATIN1", "ASCII//TRANSLIT", $ss);
return $s;
}
function __construct($directory = NULL) { function __construct($directory = NULL) {
clearstatcache(); clearstatcache();
...@@ -97,8 +102,10 @@ class RegisterUtils { ...@@ -97,8 +102,10 @@ class RegisterUtils {
} }
public function saveRegistration() { public function saveRegistration() {
$last = $this->mandatory{'last'}; $last = self::toASCII($this->mandatory{'last'});
$first = $this->mandatory{'first'}; $last = strtr($last, ' ','_');
$first = self::toASCII($this->mandatory{'first'});
$first = strtr($first, ' ','_');
$date = substr(date(DateTime::ISO8601),0,-5); $date = substr(date(DateTime::ISO8601),0,-5);
$filename = $this->directory.'/'.$last . '_' . $first . '_' . $date; $filename = $this->directory.'/'.$last . '_' . $first . '_' . $date;
$contents = ''; $contents = '';
...@@ -171,7 +178,7 @@ class RegisterUtils { ...@@ -171,7 +178,7 @@ class RegisterUtils {
foreach ($allKeys as $key) { foreach ($allKeys as $key) {
$value = str_replace($dquot,$ddquot,$values[$key]); $value = str_replace($dquot,$ddquot,$values[$key]);
$value = sprintf('"%s"',$value); $value = sprintf('"%s"',$value);
$fields[] = $value; $fields[] = utf8_decode($value);
} }
$outLine = join(';',$fields).PHP_EOL; $outLine = join(';',$fields).PHP_EOL;
fwrite($outFile,$outLine); fwrite($outFile,$outLine);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment