Jump to content
MakeWebGames

utf-8 Collation language support


q8fft
 Share

Recommended Posts

hello i'm new here and i don't know where i can post this

but really i want help if you anyone can help please

i try make script working fine and i translation to my own language and done but i got a problem when i sent mail or using mass mail in gang or sent business application (only)

and massage from player to player working fine.

they show massage like this " �ا���� ���� " i try put this code in php

 

<!-- xml version="1.0" encoding="UTF-8" --> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head></head> 
<?php

< here php >

?>

<body>
<html>

 

and i try change my Collation in database to utf8_general_ci

but no luck this change nothing?

and is this code help to fix my problem or need do something?

how can fix this please ?

Edited by q8fft
Link to comment
Share on other sites

Man I have struggled with this issue in the past :confused:

Valid version of the xhtml you posted. And what browser are you testing with?

Does the collation show as utf8 on the table as well, and does the content show correctly in the database

 

<!-- xml version="1.0" encoding="UTF-8" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>


<body>
<?php

< here php >

?>
</body>
</html>
Edited by Someone
Link to comment
Share on other sites

Man I have struggled with this issue in the past :confused:

Valid version of the xhtml you posted. And what browser are you testing with?

Does the collation show as utf8 on the table as well, and does the content show correctly in the database

sir i think my problem from mods

i have two mods don't support utf-8 or when they get info from myphpadmin they just put it and dont know if this utf-8 or not

like this mod name " attacklist.php " <--- this mod don't show username in utf-8 or text to understand it

<?php
require_once (dirname (__file__) .'/globals.php');
   $users = $db->query ("SELECT u.`userid`, u.`username`, u.`level`, u.`location`, u.`hp`, u.`gang`, g.`gangname`, g.`gangPREF` FROM `users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` ");
  echo '


<div class="generalinfo_txt">
<div><img src="images/info_left.jpg"alt=""/></div>
<div class="info_mid"><h2 style="padding-top:10px;">Attack List</h2></div>
<div><img src="images/info_right.jpg"alt=""/></div> </div>
<div class="generalinfo_simple"><br> <br><br>


  <table width="100%" class="table">
   <tr>
       <th>Player</th><th>Status</th><th>Level</th><th>Gang</th><th>Options</th>
   </tr>
  ';
              while ($u = $db->fetch_row ($users) ) {
  echo '
       <tr>
           <td>
  ';
  echo ( $u['gang'] != 0 ) ? "[".$u['gangPREF']."] ".stripslashes(htmlentities($u['username'], ENT_QUOTES)) : "".stripslashes(htmlentities($u['username'], ENT_QUOTES));
  echo '</td>
           <td>
  ';
  echo ( $u['hp'] <= 1 ) ? "<span style='font-color: red;'>Not Alive</span>" : "<span style='font-color: green;'>Alive</span>";
  echo '</td>
           <td>'.number_format($u['level']).'</td>
           <td>
  ';
  echo ( $u['gang'] != 0 ) ? "<a href='gangs.php?action=gang_view&gang_id=".$u['gang']."'>".stripslashes(htmlentities($u['gangname'], ENT_QUOTES))."</a>" : "<span>No Gang</span>";
  echo '</td>         
           <td>
  ';
  echo ( $u['hp'] <= 1 ) ? "<span style='font-color: #999; text-decoration: line-through;'>Attack</span>" : "<a href='attack.php?ID=".$u['userid']."'><span style='font-color: red;'>Attack</span></a>";
  echo '</td>
       </tr>
  ';
              }
  echo '
</table> </div><div><img src="images/generalinfo_btm.jpg"alt=""/></div><br></div></div></div></div></div>
  ';
  $h->endpage();
?> 

 

and this mod name " yourgang.php " <-- this mod don't send utf-8 mass mailer or text to understand it

<?php
include "globals.php"; 
if (!function_exists('array_diff_key')) {
function array_diff_key() {
	$arrs = func_get_args();
	$result = array_shift($arrs);
	foreach ($arrs as $array) {
		foreach ($result as $key => $v) {
			if (array_key_exists($key, $array)) {
				unset($result[$key]);
			}
		}
	}
	return $result;
}
}
if (!function_exists(array_fill_keys)) {
function array_fill_keys($keys, $value) {
	return array_combine($keys,array_fill(0,count($keys),$value));
}
}


######################
# END OF HEADER CODE #
######################

/* --------------------------------------\
Make sure to retain this query:     */
$gq=mysql_query("SELECT g.* FROM gangs g WHERE g.gangID={$ir['gang']}");
$gangdata=mysql_fetch_array($gq);
/*	Make sure to retain the above query  \
----------------------------------------*/

//error_reporting(E_ALL);

define('GANG_MODULE', true, true);

// gangID, gangNAME, gangDESC, gangPREF, gangSUFF, gangMONEY, gangCRYSTALS, gangRESPECT, gangPRESIDENT, gangVICEPRES, gangCAPACITY, gangCRIME, gangCHOURS, gangAMENT

include('./gangs/config.php');
$gvars = new GangVars();
$gvars->setPage('private');
include('./gangs/content.php');
$h->endpage();

 

my question how can make this mods show user name for player in text to understand it or like mod " cityusers.php " <-- this mode show player name great in my language

hope someone know about my problem

Edited by q8fft
Link to comment
Share on other sites

this code for show name users or " Responsible for bringing information from database " and my problem here , as it does not display the names correctly in my language

echo ( $u['gang'] != 0 ) ? "[".$u['gangPREF']."] ".stripslashes(htmlentities($u['username'], ENT_QUOTES)) : "".stripslashes(htmlentities($u['username'], ENT_QUOTES));
Link to comment
Share on other sites

no one know what is my a problmes !! anyway i fix attacklist.php

i change code " htmlentities " to "htmlspecialchars" and read my language great.

only i have now 1 php file don't support/put utf8 in my game or text to understand it

yourgang.php

Edited by q8fft
Link to comment
Share on other sites

yourgang.php does not show what is used to output content to the page, looks like the file does that ./gangs/content.php does that.

When you find it, add charset to the htmlentities()

htmlentities($u['username'], ENT_QUOTES, "UTF-8")

If that fails, there is an interesting comment at this page http://php.net/manual/en/function.htmlentities.php its the top comment on the page

- htmlentities() function remove characters like "à","è",etc when you specify a flag and a charset

- htmlentities() function DOES NOT remove characters like those above when you DO NOT specify anything

So might be worth to try htmlentities($u['username'])

Think this depends on the php version being used.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...