Web page displays '&#26297' as ' 暹'

searching for this has proven to be quite difficult and I imagine there will be other combinations I need to catch.

The MS Sql server database record has this as part of the entered data &#26297
When I pull the record into the web page and display the record via PHP it shows this as

I need to filter the output so that it will show the original input as entered on the web page.

let me add that if I do this in PHP:

echo "&#26297";

Open in new window


I get:

 

I need it to output:

&#26297


when the user puts that into a record.
ZipbangAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
echo "&#26297"
0
quizwedgeCommented:
Try wrapping the whole string in htmlentities(). See http://php.net/htmlentities for details.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
We NEVER send unfiltered / unescaped output to a client browser.  If you do that, your site becomes a threat to your user community.  Instead we follow the principles of Filter Input Escape Output.  PHP provides functions to help you do this.  Almost always without exception you must use one of these functions before writing output to the client.  Here are the required reading links:
http://php.net/manual/en/security.general.php
http://php.net/manual/en/function.htmlentities.php
http://php.net/manual/en/function.htmlspecialchars.php

It's old news, but vitally important.
http://shiflett.org/blog/2007/dec/php-advent-calendar-day-13

Here is an example showing how to escape the output.
See: http://iconoun.com/demo/temp_zipbang.php

<?php // demo/temp_zipbang.php

/**
 * http://www.experts-exchange.com/questions/28654457/Web-page-displays-%27-26297%27-as-%27-%27.html
 * http://shiflett.org/blog/2007/dec/php-advent-calendar-day-13
 */
error_reporting(E_ALL);


// USE PHP TO CREATE VARIABLES FOR OUR HTML
$raw  = '&#26297';
$safe = htmlspecialchars($raw);

// CREATE OUR WEB PAGE IN HTML5 FORMAT
$htm = <<<HTML5
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style type="text/css">
/* STYLE SHEET HERE */
</style>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
/* JQUERY CODE HERE */
});
</script>

<title>HTML5 Page in UTF-8 Encoding</title>
</head>
<body>

<p> Raw: $raw  Safe: $safe</p>

</body>
</html>
HTML5;

// RENDER THE WEB PAGE
echo $htm;

Open in new window

0
sarabhaiCommented:
$datavaluevar = "&#26297"
alert( '<?php echo $datavaluevar?>'.replace(/\&amp\;/gi, "&");
0
ZipbangAuthor Commented:
thanks for your quick response
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.