Hey i have tried to change the "locale" language on the server and on the SQL database UTF8 and such... to utf8 danish .. close to Norwegian so i can use Æ Ø Å chars but nothing works....
Everytime i use those norwegian characters its making the text Vanish!
Bump:
PHP Code:
<?php
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
parked();
if (get_user_class() < UC_USER)
stderr("Sorry", "You do not have permission to view this page.");
iplogger();
if (isset($_GET['del']))
{
if (is_valid_id($_GET['del']))
{
if ( (get_user_class() >= UC_MODERATOR) ) {
sql_query("DELETE FROM forumchat WHERE id=".mysql_real_escape_string($_GET['del']));
}
}
}
?>
<html><head>
<title>ShoutBox</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8”>
<META HTTP-EQUIV=REFRESH CONTENT="120; URL=forumchat.php">
<style type="text/css">
A {color: #000000; font-weight: bold; }
A:hover {color: #FF0000;}
.small {font-size: 8pt; font-family: tahoma; }
.date {font-size: 7pt;}
</style>
<STYLE>BODY {
background-color: #F0F0E6;
SCROLLBAR-3DLIGHT-COLOR: #004E98;
SCROLLBAR-ARROW-COLOR: #004E98;
SCROLLBAR-DARKSHADOW-COLOR: white;
SCROLLBAR-BASE-COLOR: white;
}
</STYLE>
</head>
<body bgcolor=#F5F4EA>
<?
/*
if ($CURUSER["chatpost"] == 'no')
{
print("<h2><br><center>You are banned!</center></h2>");
exit;
}
else
{
*/
if($_GET["sent"]=="yes")
if(!$_GET["shbox_text"])
{
$userid=0+$CURUSER["id"];
}
else
{
$userid=0+$CURUSER["id"];
$username=htmlspecialchars(trim($CURUSER["username"]));
$date=sqlesc(time());
$text=trim($_GET["shbox_text"]);
sql_query("INSERT INTO forumchat (id, userid, username, date, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
}
$res = sql_query("SELECT * FROM forumchat ORDER BY date DESC LIMIT 70") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("\n");
else
{
print("<table border=0 cellspacing=0 cellpadding=2 width='100%' align='left' class='small'>\n");
while ($arr = mysql_fetch_assoc($res))
{
$res2 = sql_query("SELECT username,class,avatar,donor, title,enabled,warned FROM users WHERE id=$arr[userid]") or sqlerr(__FILE__, __LINE__);
$arr2 = mysql_fetch_assoc($res2);
$resowner = sql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());
$rowowner = mysql_fetch_array($resowner);
if ($rowowner["class"] == "7")
$usercolor= "<font color=darkred>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($rowowner["class"] == "6")
$usercolor= "<font color=#2587A7>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "5")
$usercolor= "<font color=#B000B0>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "4")
$usercolor= "<font color=#ff5151>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "3")
$usercolor= "<font color=#6464FF>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "2")
$usercolor= "<font color=#009F00>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "1")
$usercolor= "<font color=#f9a200>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "0")
$usercolor= "<font color=#000000>" .htmlspecialchars($rowowner["username"]). "</font>";
if (get_user_class() >= UC_MODERATOR) {
$del="<span class='date'>[<a href=forumchat.php?del=".$arr[id].">del</a>]</span>";
}
print("<tr><td><span class='date'>[".strftime("%d.%m %H:%M",$arr["date"])."]</span>
$del
</span>
<a href='userdetails.php?id=".$arr["userid"]."' target='_blank'>$usercolor</a>" .
($arr2["donor"] == "yes" ? "<img src=pic/star.gif alt='DONOR'>" : "") .
($arr2["warned"] == "yes" ? "<img src="."pic/warned.gif alt='Warned'>" : "") .
" ".format_comment($arr["text"])."
</td></tr>\n");
}
print("</table>");
}
?>
</body>
</html>
Bump: I changed the locale on the server side .. to NB_NO utf 8 and also in apache2 MySQL ..
such as this :
Quote:
sudo nano /etc/mysql/my.cnf
my.cnf:
[client]
default-character-set = utf8
[mysqld]
character-set-server = utf8
sudo /etc/init.d/mysql restart
sudo nano /etc/php5/apache2/php.ini
; PHP’s default character set is set to empty.
; http://php.net/default-charset
default_charset = “UTF-8″
sudo nano /etc/apache2/conf.d/charset
#AddDefaultCharset UTF-8
to
AddDefaultCharset UTF-8
sudo /etc/init.d/apache2 restart
|
but this didn’t work for me. Any other ideas?
Bump: The forum chat, shout box and the Forum txt are vanishing if i use Norwegian chars like ÆØÅ