AnimeSuki Forums

Register Forum Rules FAQ Members List Social Groups Search Today's Posts Mark Forums Read

Go Back   AnimeSuki Forum > AnimeSuki & Technology > Tech Support

Notices

Reply
 
Thread Tools
Old 2006-01-24, 03:01   Link #1
Lanthis
Nen Addict
 
Join Date: Feb 2003
Programming Question

I thought perhaps someone here may have experience with my problem.

I'm trying to write a PHP script that pulls Japanese characters (utf8_general_ci) from a MySQL database and echos the table. Does anyone know how I do this?
Lanthis is offline   Reply With Quote
Old 2006-01-24, 13:41   Link #2
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
I don't think you need to do anything. Just set the encoding of the html to UTF8 and print the data from MySQL as you usually would.

e.g. "<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">"

You'll have to watch out when using string functions. Not all of them are unicode-safe and in case you need one, you'll need to activate the mbstring php extension and use it's replacement functions.
__________________
MPlayer OSX Extended (en) | nimmermehr (de) | sttz (de) | last.fm
Life is a game whose first rule is: This is not a game, this is dead serious.
anime_layer is offline   Reply With Quote
Old 2006-01-24, 15:18   Link #3
Sylf
翻訳家わなびぃ
*Fansubber
 
 
Join Date: Nov 2003
Age: 40
Send a message via MSN to Sylf Send a message via Yahoo to Sylf
Using META tag to specify character set is fine and all, but the better way to do is to actually write the HTTP header using PHP before making any text output.
Code:
<?PHP header("content-type: text/html; charset=UTF-8"); ?>
If you;re strictly doing retrieving text from MySQL and displaying the text without any modifications, regular echo/print statement works just as if you were handling ASCII text.
Sylf is offline   Reply With Quote
Old 2006-01-24, 20:53   Link #4
Lanthis
Nen Addict
 
Join Date: Feb 2003
I got it to work in Firefox, but in IE it just displays random ASCII stuff, but if you view source in IE, it displays the Asian characters... what the heck.
Lanthis is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 21:45.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
We use Silk.