Aufnahme von hacek-Sonderzeichen in Funktion covertProblemChars

This commit is contained in:
ma0068
2021-10-08 10:24:46 +02:00
parent 4c156f7f39
commit 3ff3353aae
2 changed files with 49 additions and 28 deletions
@@ -2010,3 +2010,16 @@ function MitarbeiterUDFIFrameLoad()
}
catch(e) {}
}
// ****
// * Validierung Alias auf Sonderzeichen (analog zu checkWunschUid, außerdem . und _ erlaubt)
// ****
function checkAlias()
{
var alias = document.getElementById('mitarbeiter-detail-textbox-alias').value;
if (/^[a-z0-9 . _]*$/i.test(alias) === false)
{
alert('Der Alias darf keine Sonderzeichen enthalten');
}
}
+36 -28
View File
@@ -455,42 +455,50 @@ function intersect($str1, $str2)
* Konvertiert Problematische Sonderzeichen in Strings fuer
* Accountnamen und EMail-Aliase
*
* @param $str
* @return bereinigter String
* @param string $str Inputparameter.
* @return string bereinigter String.
*/
function convertProblemChars($str)
{
$enc = 'UTF-8';
$acentos = array(
'A' => '/À|Á|Â|Ã|Å/',
'Ae' => '/Ä/',
'a' => '/à|á|â|ã|å/',
'ae'=> '/ä/',
'C' => '/Ç/',
'c' => '/ç/',
'E' => '/È|É|Ê|Ë/',
'e' => '/è|é|ê|ë/',
'I' => '/Ì|Í|Î|Ï/',
'i' => '/ì|í|î|ï/',
'N' => '/Ñ/',
'n' => '/ñ/',
'O' => '/Ò|Ó|Ô|Õ/',
'Oe' => '/Ö/',
'o' => '/ò|ó|ô|õ/',
'oe' => '/ö/',
'U' => '/Ù|Ú|Û/',
'Ue' => '/Ü/',
'u' => '/ù|ú|û/',
'ue' => '/ü/',
'Y' => '/Ý/',
'y' => '/ý|ÿ/',
'a.' => '/ª/',
'o.' => '/º/',
'ss' => '/ß/'
'A' => '/À|Á|Â|Ã|Å|Ă|Ǎ/',
'Ae' => '/Ä/',
'a' => '/à|á|â|ã|å|ă|ǎ/',
'ae' => '/ä/',
'C' => '/Ç|Č/',
'c' => '/ç|č/',
'E' => '/È|É|Ê|Ë/',
'e' => '/è|é|ê|ë/',
'I' => '/Ì|Í|Î|Ï/',
'i' => '/ì|í|î|ï/',
'N' => '/Ñ|Ň|ň/',
'n' => '/ñ/',
'O' => '/Ò|Ó|Ô|Õ/',
'Oe' => '/Ö/',
'o' => '/ò|ó|ô|õ/',
'oe' => '/ö/',
'R' => '/Ř/',
'r' => '/ř/',
'S' => '/Š/',
's' => '/š/',
'T' => '/Ť/',
't' => '/ť/',
'U' => '/Ù|Ú|Û|Ŭ|Ǔ/',
'Ue' => '/Ü/',
'u' => '/ù|ú|û|ŭ|ǔ/',
'ue' => '/ü/',
'Y' => '/Ý/',
'y' => '/ý|ÿ/',
'Z' => '/Ž/',
'z' => '/ž/',
'a.' => '/ª/',
'o.' => '/º/',
'ss' => '/ß/'
);
return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
return preg_replace($acentos, array_keys($acentos), htmlentities($str, ENT_NOQUOTES | ENT_HTML5, $enc));
}
//Ersetzt alle Problemzeichen in einem String bevor dieser als xml oder rdf ausgegeben wird