设了的。

2009/12/20 cnhack TNT <[email protected]>

> 表单网页,HTML 的 <head> 中
>
> <*META* http-equiv="Content-Type" content="text/*html*; *charset*=UTF-8">
>
> 设了么?
>
> 2009/12/20 Mike.G <[email protected]>
>
>>  这回比较复杂,我都头疼死了。
>> 先描述一下:
>> 我使用CGI::Application作为我的web framework,
>> 然后使用了tt2作为我的模板系统,同时使用了CGI::Application::Plugin::ValidateRM插件
>> 可以直接使用Data::FormValidator用作表单验证,另外也可以使用HTML::FillInForm 作为表单重填。
>>
>> 在配置tt2的使用使用了如下的配置参数:
>>     INCLUDE_PATH=>'/home/ghw/myperl/5anet/template/:'.
>>                 '/home/ghw/myperl/5anet/template/email:'.
>>                 '/home/ghw/myperl/5anet/template/webtools',
>>
>>     #指定编译后的模板目录
>>     COMPILE_DIR=>'/dev/shm',
>>     #编译后的扩展名参数
>>     COMPILE_EXT=>'.ttc',
>>
>>     #指定模板的编码
>>   *  ENCODING=>'utf8',*
>>
>>     #当在mod_perl和fast_cgi中使用时
>>     #可以打开下面的cache_size和stat_ttl
>>     #选项。尽量使用比较大的值对于stat_ttl来说。
>>     #具体说明请参考TT2的文档
>>     #cache_size不指定值时缓存所有的模板
>>     #CACHE_SIZE=>100,
>>     #STAT_TTL=>60(一分钟)
>>
>>     #加入全局变量
>>     VARIABLES=>{
>>         root_url=>$CFG{'root_url'},
>>         root_image_url=>$CFG{'root_image_url'},
>>         root_css_url=>$CFG{'root_css_url'},
>>         root_js_url=>$CFG{'root_js_url'},
>> #        root_help_url=>$CFG{'root_help_url'},
>> #        root_forum_url=>$CFG{'root_forum_url'},
>>         root_app_url=>$CFG{'root_app_url'},
>>     },
>>
>> 注意我指定了假设所有的模板文件都是utf-8编码的,实际上也的确是使用了utf-8编码。
>>
>> 另外在连接数据库的时候,我使用如下的配置参数:
>> $CFG{'db_attr'} = {
>>     RaiseError=>1,
>>     AutoCommit=>1,
>>   *  mysql_enable_utf8=>1*
>> };
>>
>> 这里也是使用了utf-8
>>
>> 另外其他各个模块里我也使用了
>> use utf8;
>>
>> 这样基本上解决了所有的UTF-8 带来的乱码问题。
>> 但是在处理一个注册表单的问题时,
>> 例如:用户昵称我使用了中文,如果表单注册失败回到注册页面时, 会自动重填,这个时候我就发现。有问题了,中文的重填内容全部变成了乱码。
>>
>> 哪位大大指点一下?
>>
>> 谢谢
>>
>>
>> Mike.G
>>
>>  --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>

--

您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。


回复