Jump to content

Japanese Text


Crozarius

Recommended Posts

I have been trying to figure out how to get my PHP script to display Japanese characters correctly. Whenever the array containing the characters is out put, they show up as ??

 

Ex:

Array ( [number] => 5414 [katahira] => ?? [romaji] => neko [kanji] => ? [definition] => cat [kanji pronunciation] => ?…?? ) ??

 

The characters show up correctly on my Mysql web interface fine. They are entered as:

Type: tinytext

Collation: utf8_unicode_ci

 

I have looked over a lot of pages, but the fixes are not working for me.  Anyways, here is my code:

 

<?php

header('Content-Type: text/html;charset= utf8_unicode_ci');

 

$databaseName = bc1253;// database that is used

 

// connects to the database

$connection = mysql_connect("*******", "*********", "**********");

mysql_select_db($databaseName, $connection);

 

// searches the data base and returns the row the object is found in.

$result = mysql_query("SELECT * FROM Japanese WHERE Romaji = '$_POST[Word]'")

    or die("broken");

 

// Puts row of results in an array

$outPut = mysql_fetch_array($result, MYSQL_ASSOC);

 

Print_r($outPut);

?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

actually, you have to select "convert to UTF-8 without BOM" in notepad++ and save the file in order to display the characters correctly in your browser. "Encode in UTF-8 Without BOM" will only change the display in the file view.

 

Additioanlly, you browser encoding has to bet set to utf-8 as well.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.