[PerlChina] 停止/开始 Perl 脚本后台模式运行

Jesse Lee cdrplum at gmail.com
Sun Oct 28 07:40:11 PDT 2007


多谢了,稍后改一下试试。

On 10/28/07, Jeff Pang <pangj at earthlink.net> wrote:
>
> On 10/28/07, Jesse Lee <cdrplum at gmail.com> wrote:
> >有一个使用 Jabber 协议的聊天程序,通过客户端发送的信息存到 MySQL 数据库后中文文字变成了这样的:
> > &#x4FE1;&#x606F;&#x592A;&#x77ED;
> > 上面对应的是 "信息太短" 四个字,使用的都是 UTF8 编码,在网页上显示也是正常的,这样是否正常呢?
> >  能否变成直接的中文?在 phpmyadmin 中看到中文?
> >
>
> Before inserting into database,you will add a set names statement:
>
> $sth = $dbh->prepare("set names 'utf8'");
> $sth->execute();
>
> Also you'd better translate the values from gb* to utf-8 before inserting.
>
> use Encode;
> $cn_characters = "信息太短";
> $cn_characters = encode("utf8",decode("gb2312",$cn_characters));
>
> then in sql,
>
> insert into table (cn_character_column) values ($cn_characters);
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm




-- 
<a href="http://www.digbuzz.com/" target="_blank"><img src="
http://www.digbuzz.com/images/btns/468x60-1.gif" width="468" height="60"
border="0" /></a>
<br />
    <span style="font-size: 12px; font-family: Arial, Helvetica,
sans-serif;">我挖网 <a href="http://www.digbuzz.com/" target="_blank">
www.digbuzz.com</a> - Web 2.0 用户挖新闻社区</span>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20071028/82cac192/attachment.html 


More information about the China-pm mailing list