View topic - making Japanese text display in browser when coding php/html
making Japanese text display in browser when coding php/html
5 posts
• Page 1 of 1
making Japanese text display in browser when coding php/html
I figured out that I could get Japanese text into a database by changing the collation and I was proud of myself for that, but now I can't figure out how to get the database to spit that Japanese text back into a browser when using php or html. There's a section in my php file that looks like this:
echo $row["jap"] . "<br>";
echo "青い<br>";
?>
青い<br>
I wanted to try to see if any of those 3 would display right. What comes out is
??
é’ã„
é’ã„
Is there a way to tell the browser to change settings that would allow the text to actually display as 青い? Also, I specifically need the first line to display properly, and since it didn't even bother spitting out garbage, are there extra steps I would have to take?
echo $row["jap"] . "<br>";
echo "青い<br>";
?>
青い<br>
I wanted to try to see if any of those 3 would display right. What comes out is
??
é’ã„
é’ã„
Is there a way to tell the browser to change settings that would allow the text to actually display as 青い? Also, I specifically need the first line to display properly, and since it didn't even bother spitting out garbage, are there extra steps I would have to take?
www.bananamonkeyninja.com
The only webcomic endorsed by Banana Monkey Ninja
The only webcomic endorsed by Banana Monkey Ninja
-

Dehitay - Posts: 1010
- Joined: Fri 09.08.2006 8:36 pm
- Location: San Antonio, Texas, USA
- Native language: English
- Gender: Male
Re: making Japanese text display in browser when coding php/html
The last two lines look like you're using UTF-8, but not telling the browser what to expect. Do you have something in the <head> section of your HTML like this?
As for the database result... it's been a long time since I last used PHP and you didn't say which database you're using, but I googled a bit and found some people using MySQL who had the same problem. They fixed it by doing the following after creating the connection to the database:
- Code: Select all
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
As for the database result... it's been a long time since I last used PHP and you didn't say which database you're using, but I googled a bit and found some people using MySQL who had the same problem. They fixed it by doing the following after creating the connection to the database:
- Code: Select all
mysql_query("SET NAMES 'utf8'");
- ニッキー
- Posts: 90
- Joined: Mon 07.28.2008 5:34 am
- Location: Europe
- Native language: British English
- Gender: Female
Re: making Japanese text display in browser when coding php/html
I guess I really should have posted the entire code since it was so ridiculously small anyways. But even without seeing the rest of it, you pretty much guessed just what it looks like. I was using MySQL and currently I only had title tags in the head. And the 2 code snippets you gave me solved the problem. Thanks a ton. Whenever I tried to google the problem, I got answers for problems completely unrelated to it.
www.bananamonkeyninja.com
The only webcomic endorsed by Banana Monkey Ninja
The only webcomic endorsed by Banana Monkey Ninja
-

Dehitay - Posts: 1010
- Joined: Fri 09.08.2006 8:36 pm
- Location: San Antonio, Texas, USA
- Native language: English
- Gender: Male
Re: making Japanese text display in browser when coding php/html
Glad I could help. 
- ニッキー
- Posts: 90
- Joined: Mon 07.28.2008 5:34 am
- Location: Europe
- Native language: British English
- Gender: Female
Re: making Japanese text display in browser when coding php/html
Whenever doing any web stuff with Japanese, make sure you put UTF-8 tags in everything. It'll solve most of your problems 
-

keatonatron - Posts: 4838
- Joined: Sat 02.04.2006 3:31 am
- Location: Tokyo (Via Seattle)
- Native language: English
- Gender: Male
5 posts
• Page 1 of 1
Return to Computers & Technology
Who is online
Users browsing this forum: No registered users and 0 guests







Click to sign up
