Проблема: я нашел php-код (игра в палач) и хочу, чтобы он работал на немецком языке, но он выводит A � � ���BCF вместо следующих букв: Ü Ä Ö
Как можноя исправляю это .. и использую только кодировку utf-8 ??
вот весь код:
<?php
$Category = "Web Programming";
$list = "VERSCHLÜSSELUNG";
$alpha = "AÜÄÖÇBCDEFGHIJKLMNOPQRSTUYVWXYZ";
$additional_letters = " -.,;!?%&0123456789";
mb_internal_encoding("UTF-8");
$len_alpha = mb_strlen($alpha);
if(isset($_GET["n"])) $n=$_GET["n"];
if(isset($_GET["letters"])) $letters=$_GET["letters"];
if(!isset($letters)) $letters="";
if(isset($PHP_SELF)) $self=$PHP_SELF;
else $self=$_SERVER["PHP_SELF"];
$links="";
$max=6; # maximum number of wrong
# error_reporting(0);
$words = explode("\n",$list);
srand ((double)microtime()*1000000);
$all_letters=$letters.$additional_letters;
$wrong = 0;
if (!isset($n)) { $n = rand(1,count($words)) - 1; }
$word_line="";
$word = trim($words[$n]);
$done = 1;
for ($x=0; $x < mb_strlen($word); $x++)
{
if (strstr($all_letters, $word[$x]))
{
if ($word[$x]==" ") $word_line.=" "; else $word_line.=$word[$x];
}
else { $word_line.="_<font size=1> </font>"; $done = 0; }
}
if (!$done)
{
for ($c=0; $c<$len_alpha; $c++)
{
if (mb_strstr($letters, $alpha[$c]))
{
if (mb_strstr($words[$n], $alpha[$c]))
{$links .= "\n<B>$alpha[$c]</B> ";
}
else { $links .= "\n<FONT color=\"red\">$alpha[$c] </font>"; $wrong++;
}
}
else
{
$links .= "\n<A HREF=\"$self?letters=$alpha[$c]$letters&n=$n\">$alpha[$c]</A> ";
}
}
$nwrong=$wrong; if ($nwrong>6) $nwrong=6;
echo "\n<p><BR>\n<IMG SRC=\"hangman_$nwrong.gif\" ALIGN=\"MIDDLE\" BORDER=0 WIDTH=110 HEIGHT=185 ALT=\"Wrong: $wrong out of $max\">\n";
if ($wrong >= $max)
{
$n++;
if ($n>(count($words)-1)) $n=0;
echo "<BR><BR><H1><font size=5>\n$word_line</font></H1>\n";
echo "<p><BR><FONT color=\"red\"><BIG>You Lost!</BIG></FONT><BR><BR>";
if (strstr($word, " ")) $term="fraz?"; else $term="?odis";
echo "The word was \"<B>$word</B>\"<BR><BR>\n";
echo "<A HREF=$self?n=$n>Play Again... </A>\n\n";
}
else
{
echo " Remaining guesses: <B>".($max-$wrong)."</B><BR>\n";
echo "<H1><font size=5>\n$word_line</font></H1>\n";
echo "<P><BR>Please choose a letter: <BR><BR>\n";
echo "<font size=3> $links \n</font>";
}
}
else
{
$n++; # get next word
if ($n>(count($words)-1)) $n=0;
echo "<BR><BR><H1><font size=5>\n$word_line</font></H1>\n";
echo "<P><BR><BR><B><font color=red size=2>You Won</font></B><BR><BR><BR>\n";
echo "<A HREF=$self?n=$n>Play Again... </A>\n\n";
}
?>