打开symfony官方网站的图片

symfony

  One Response to “symfony网站搞啥呢”

  1. 解决view.yml使用UTF-8中文乱码的问题,解决方法如下:
    找到symfony/config/sfViewConfigHandler.class.php中的一段代码:
    htmlentities($content, ENT_QUOTES, sfConfig::get(‘sf_charset’)
    把它更改为:
    iconv(“gb2312″, sfConfig::get(‘sf_charset’), $content)
    ‘sf_charset’ 是 settings.yml中charset的部分,这里设置为utf-8。
    原理如下:
    sfViewConfigHandle解析view.yml中的参数,并在cache/myapp/dev/config和cache/myapp/prod/config下生成modules_xxx_config_view.yml.php文件,xxx代表module的名称。原代码只将$content变量中的字符转换成了utf-8的字符,但生成的modules_xxx_config_view.yml.php文件却是ANSI格式的。所以输出会出现乱码。
    注意:更改以上代码后,view.yml文件用gb2312格式。如果需用到其他格式,可以把iconv的函数中的gb2312改为相应格式。
    此方法,只解决了view.yml中的UTF-8的中文字符问题。至于其他的yml文件还暂时没有找到解决方法。但是,除了validator中需要用到中文字符提示错误以外,其他的基本上不需要有中文。而validator的中文问题可以使用i18n解决。

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 刘敏的Blog Suffusion theme by Sayontan Sinha