FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » How to read Chinese characters from MySQL database (puzzle me on stor and read character using FUDforum)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to read Chinese characters from MySQL database [message #38699 is a reply to message #38652] Thu, 23 August 2007 00:26 Go to previous messageGo to previous message
nectar2 is currently offline  nectar2   China
Messages: 26
Registered: April 2005
Karma:
Junior Member
Thanks for your replay, Ilia.

I'm a newbie, looks like there are still un-read Chinese characters after set utf8 via 'MySQL Charset Changer'. I searched on Internet, there are some usefulness topic, like http://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statem ents.html.

So I tried to change some(add SET NAMES 'UTF8'):

fudforum/index.php

from:
if (!defined('fud_sql_lnk')) {
	$connect_func = $GLOBALS['FUD_OPT_1'] & 256 ? 'mysql_pconnect' : 'mysql_connect';
	$conn = $connect_func($GLOBALS['DBHOST'], $GLOBALS['DBHOST_USER'], $GLOBALS['DBHOST_PASSWORD']) or die (fud_sql_error_handler("Initiating $connect_func", mysql_error(fud_sql_lnk), mysql_errno(fud_sql_lnk), "Unknown"));
	define('fud_sql_lnk', $conn);


to:
if (!defined('fud_sql_lnk')) {
	$connect_func = $GLOBALS['FUD_OPT_1'] & 256 ? 'mysql_pconnect' : 'mysql_connect';
	$conn = $connect_func($GLOBALS['DBHOST'], $GLOBALS['DBHOST_USER'], $GLOBALS['DBHOST_PASSWORD']) or die (fud_sql_error_handler("Initiating $connect_func", mysql_error(fud_sql_lnk), mysql_errno(fud_sql_lnk), "Unknown"));
        mysql_query("SET NAMES 'UTF8'");
	define('fud_sql_lnk', $conn);


And then, looks like it can safe Chinese characters at MySQL(v4.1+). But there is a still ????? at fudforum/adm/admforum.php, but fudforum/adm/admcat.php is ok.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Web Site Integration
Next Topic: Mailman to FUDforum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 04:41:29 GMT 2024

Total time taken to generate the page: 0.04012 seconds