Re[2]: [PHP] Japanese with UTF-8 and mysql
| From: | Richard Davey | Date: | Thu, 02 Jun 2005 10:58:26 +0000 |
| Subject: | Re[2]: [PHP] Japanese with UTF-8 and mysql | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-216217@lists.php.net to get a copy of this message | ||
Hello Mark,
Thursday, June 2, 2005, 4:18:30 AM, you wrote:
MS> <?php
MS> session_start();
MS> include("database.php");
?>>
I would recommend setting UTF-8 as the Content-type via PHP itself:
header('Content-type: UTF-8') - do it as one of the first things when
you're ready to output the HTML.
MS> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
MS>
MS> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This may well be a cause of the problem - your HTML doesn't look like
it's XTHML Strict compatible at all, so browsers are going to
re-render it (IE into Quirks mode). I would remove the DocType for now
or fix the mark-up errors.
MS> <?php
MS> if (isset($_REQUEST[product_id])) {
MS> $product_id = $_REQUEST[product_id];
See the previous reply about why this isn't safe, but also it should
be: $_REQUEST['product_id'] (note the quotes) to avoid PHP scanning
for constants.
MS> for ($i=0; $i<$num; $i++){
MS> echo "<tr align=\"center\"><td>PRODUCT
MS>
MS> NAME</td><td>".$rows['product_name']."</td><br><tr
From a code point of view this is correct. Let's check a few obvious
things: does PHP have the mb extension installed? If so what is the
default character-set in php.ini?
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov