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

Home » FUDforum Development » Plugins and Code Hacks » Codes to judge Simplified Chinese characters(GB2312)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Codes to judge Simplified Chinese characters(GB2312) [message #8237 is a reply to message #7961] Sat, 18 January 2003 14:13 Go to previous messageGo to previous message
laser is currently offline  laser   China
Messages: 9
Registered: January 2003
Karma:
Junior Member
emm, I think it's better to use DB to do such job.
I'm using PostgreSQL, it has excellent encoding transform tools.
we can change the encoding between client (php cgi) and server (DB) using some simple query.
In my installation, I created my forum DB using UNICODE encoding.
then I added a global variable into GLOBAL.php:

$DBCLIENT_ENCODING = "GBK";

and then, add a few lines in index.php right after the connection has been made:

if(__dbtype__ == 'pgsql' && __db_connection_ok_ ){
$query = 'SET CLIENT_ENCODING TO '.'\''.$GLOBALS['DBCLIENT_ENCODING'].'\'';
pg_query($GLOBALS['__DB_INC__']['SQL_LINK'], $query);
}

now, we can use PostgreSQL's encoding conversion to support GBK/GB2312 encoding, and the DB still use UNICODE, if we change
the encoding to other scheme, we still can use the same DB, PostgreSQL would do the translation for us automatically.
Don't know much about mysql, but I think we could use some kind
of switch to utilize the DB's feature if it's possible.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: russian translation fixes
Next Topic: pubcookie authentication
Goto Forum:
  

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

Current Time: Sun Nov 24 15:50:56 GMT 2024

Total time taken to generate the page: 0.04863 seconds