note 103939 modified in function.htmlspecialchars by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 May 2011 18:32:16 +0000 |
| Subject: | note 103939 modified in function.htmlspecialchars by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179662@lists.php.net to get a copy of this message | ||
English:
I'd found THE Final Solution!
it finds and replaces all unknown letters!
(like Ã, Ã, Ã, Ã, and much much more)
it turn em in a HTML AND XML compatible format
parameter: $text: a String with unsuported letters in it
return: a String where all unsupported(XML und HTML) letters are changed into the Unicode value (for
example Ä)
Deutsch/German:
Ich hab die perfekte Lösung gefunden!
Es findet und tauscht alle unbekannten Buchstaben!
(wie Ã, Ã, Ã, Ã, und viel viel mehr)
es tauscht sie in ein HTML und XML kompatibles Format
parameter: $text: ein String mit nichtunterstüzten Buchstaben
return: ein String wo alle von XML und HTML ununterstützten Buchstaben ins Unicode-Format
getauscht sind (z.B. Ä)
FUNCTION:
<?php
function umlaute($text){
$returnvalue="";
for($i=0;$i<strlen($text);$i++){
$teil=hexdec(rawurlencode(substr($text, $i, 1)));
if($teil<32||$teil>1114111){
$returnvalue.=substr($text, $i, 1);
}else{
$returnvalue.="&#".$teil.";";
}
}
return $returnvalue;
}
?>
--was--
English:
I'd found THE Final Solution!
it finds and replaces all unknown letters!
(like Ã, Ã, Ã, Ã, and much much more)
it turn em in a HTML AND XML compatible format
parameter: $text: a String with unsuported letters in it
return: a String where all unsupported(XML und HTML) letters are changed into the Unicode value (for
example Ä)
Deutsch/German:
Ich hab die perfekte Lösung gefunden!
Es findet und tauscht alle unbekannten Buchstaben!
(wie Ã, Ã, Ã, Ã, und viel viel mehr)
es tauscht sie in ein HTML und XML kompatibles Format
parameter: $text: ein String mit nichtunterstüzten Buchstaben
return: ein String wo alle von XML und HTML ununterstützten Buchstaben ins Unicode-Format
getauscht sind (z.B. Ä)
FUNCTION:
function umlaute($text){
$returnvalue="";
for($i=0;$i<strlen($text);$i++){
$teil=hexdec(rawurlencode(substr($text, $i, 1)));
if($teil<32||$teil>1114111){
$returnvalue.=substr($text, $i, 1);
}else{
$returnvalue.="&#".$teil.";";
}
}
return $returnvalue;
}
http://php.net/manual/en/function.htmlspecialchars.php