Hi!
I'm trying to pass special greek characters (α +) to another page. The greek characters are imported from a character map page which outputs the character to the text field box which is a WYSIWIG HTML text editor. If I pass the list box to the next page inside a hidden field by only using an echo command, the characters gets outputted ok. Except, If I want to pass the html coding using the htmlentities function, the character gets changed. For ex: Γ becomes Ã
The php code I use for transferring the value to the next page is:
<input type="hidden" name="Introduction" value="<?
function superhtmlentities($text) {
$entities = array(128 => 'euro', 130 => 'sbquo', 131 => 'fnof', 132 => 'bdquo', 133 => 'hellip', 134 => 'dagger', 135 => 'Dagger', 136 => 'circ', 137 => 'permil', 138 => 'Scaron', 139 => 'lsaquo', 140 => 'OElig', 145 => 'lsquo', 146 => 'rsquo', 147 => 'ldquo', 148 => 'rdquo', 149 => 'bull', 150 => '#45', 151 => 'mdash', 152 => 'tilde', 153 => 'trade', 154 => 'scaron', 155 => 'rsaquo', 156 => 'oelig', 159 => 'Yuml');
$new_text = '';
for($i = 0; $i < strlen($text); $i++) {
$num = ord($text{$i});
if (array_key_exists($num, $entities)) {
switch ($num) {
case 150:
$new_text .= '-';
break;
default:
$new_text .= '&'.$entities[$num].';';
}
}
else
if($num < 127 || $num > 159) {
$new_text .= htmlentities($text{$i});
}
}
return $new_text;
}
$Introduction = superhtmlentities($_POST['Introduction']); $Introduction = stripslashes($Introduction); echo $Introduction;?>">
I have also added a Meta tag on the next page which is:
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
Can someone help me over this matter? I would greatly appreciate it! Thanks!