Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

I have exhausted every source that I can find online to fix this echo.

Custom Title Activated
Loyal Member
Joined
Mar 26, 2012
Messages
1,465
Reaction score
131
I have tried so many freaking text encoding and none work. It either shows all incorrect or the diamonds with the question mark in the echo. Currently this is what it shows: ~Vishni¢Óez~ when it should show ~Vishni†ez~. If you guys can offer me a hand that would be great. Thanks for your time.

PHP:
<?php
// Tried multiple text encoding techniques and none show correctly!
include('config/config.php'); 
 ?>
<form id="finduser"  method="POST" action="">
<input type='text' id='name' name='name'>
<input type="Submit" Value="Search for User">
<input type="hidden" name="action" value="submitted">
</form>
<?php
if ($_POST['action'] == 'submitted')
{
$name=$_POST['name'];
error_reporting(E_ALL);
ini_set('display_errors', 1);
global $link;
mssql_select_db("Tantra",$link);
$row = mssql_query("SELECT * FROM GameInfo00 WHERE CharacterName = '$name'")or die('Error with query');
$final = mssql_fetch_array($row)or die('Cannot continue query');
echo $final[7];
}
?>
 
Junior Spellweaver
Joined
Oct 27, 2008
Messages
165
Reaction score
89
Don't know if it will help, if your using MSSQL set the column type to nVarchar, or nText(from Varchar or Text) where you have unicode text, inserted in the database, and set your page charset:

Code:
<meta charset="UTF-8">
 
Custom Title Activated
Loyal Member
Joined
Mar 26, 2012
Messages
1,465
Reaction score
131
tested in both nVarchar as well as nText with the meta charset as you have posted and it is doing the exact same thing as before which is to show the diamonds with question marks in it as predicted.
 
Joined
May 23, 2008
Messages
1,071
Reaction score
574
Your code is susceptible to . You should fix this by using . Doing this will allow your database to treat the query as a query, and the data as data. Currently, you're treating the data as part of the query, which leaves you susceptible to SQL injection. Note that simply filtering the input string with PHP functions is not enough, as there are certain ways to exploit through that.

makes this easy, and should be available to you with the mssql lib that you're currently using. It may also help with your encoding issue, as you'd be treating the character name as data rather than as part of the query.

Something along the lines of:
PHP:
$statement = $pdo->prepare("SELECT * FROM GameInfo00 WHERE CharacterName = :characterName");
$statement->execute(array(':characterName' => $name));
 
Custom Title Activated
Loyal Member
Joined
Mar 26, 2012
Messages
1,465
Reaction score
131
I already have sql injection blocks in place but, this is a simple test in order to echo the correct values from mssql server in php. This is all I asked about for the time being. Thank you for your concern though. I will give your idea try though to see if it works.



Did not echo the correct values again.
 
Joined
Dec 15, 2009
Messages
1,387
Reaction score
236
PHP:
<?php
$mysqli->query("update table set hash = N'~Vishni†ez~' where id =1");
$test = mysqli_fetch_row($mysqli->query("select table from gd_cache where id = 1"));
echo $test[0];
?>
win.

==
btw, it only took me 5 minutes to do research and test.
 
Custom Title Activated
Loyal Member
Joined
Mar 26, 2012
Messages
1,465
Reaction score
131
This is NOT mysql. This is Microsoft SQL server. And yes I can do that but, this system is auto updated which means it is updated via exe file and not through the website. It only displays through the website after. Nice try though NUBpro but, you failed. LOL
 
Junior Spellweaver
Joined
Oct 27, 2008
Messages
165
Reaction score
89
But if you had a table that stores data in Multibyte, and then you change it to Unicode, the old data would look the same and will not update to unicode.

So what NubPro says is your application stores data in Multibyte in the database, you have to change the query in your application with N'%s'(or what ever your application is using), for it to store in Unicode.
 
Newbie Spellweaver
Joined
Mar 13, 2008
Messages
38
Reaction score
2
Where are you watching echo on Web or MSSQL?

if is on web add this on your php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
your code
</html>
 
Newbie Spellweaver
Joined
Nov 6, 2012
Messages
45
Reaction score
6
I think it's about an issue in the mssql driver
 
Joined
Dec 15, 2009
Messages
1,387
Reaction score
236
This is NOT mysql. This is Microsoft SQL server. And yes I can do that but, this system is auto updated which means it is updated via exe file and not through the website. It only displays through the website after. Nice try though NUBpro but, you failed. LOL
appreciate the sarcasm.

You are not providing adequate information for us to understand the situation.
At the moment, I have literally absolute idea what you're looking for. Have fun fixing it yourself and I won't mind if I've been called as a newbie because I am.

Good luck.
 
Custom Title Activated
Loyal Member
Joined
Mar 26, 2012
Messages
1,465
Reaction score
131
I was making fun of your name not you in general. Anyhow definitely thank you for your attempt but, we did finally figure out what was going on and yes I am an idiot for not thinking of it sooner. The files were saved as UTF8 instead of ANSII.
 
Joined
Dec 15, 2009
Messages
1,387
Reaction score
236
Oh well. This is embarrassing.

I had this
$asset = $PDO->prepare("SELECT Name FROM dbo.Character WHERE AID = '2'");

Output:
Array ( [Name] => ?????????? [0] => ?????????? )

Actual text is ♥♥♥♥♥♥♥♥♥♥

And yes, this time around I am using SQL server. I just don't understand why it wouldn't work. :blushing:
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
899
Use HTML 5, set character set to UTF8. Make sure your database
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>

<body>
Content of the document......
</body>

</html>

I also suggest to make sure that your server stores the information in a unicodeformat (utf8)

 
Back
Top