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
https://forums.phpfreaks.com/topic/199842-japanese-text/
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
https://forums.phpfreaks.com/topic/199842-japanese-text/#findComment-1049021
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.