lsstarboy 发表于 2009-12-25 08:39

BSD下statusnet的中文tag修正


                问题:
    1、nginx无法使用.htaccess来完成短地址的解析
   
    2、中文tag不能使用,显示乱码。
解决:
   
   1、    server {
      listen 80;
      server_nameblog.test.com;
      charset utf-8;
      location /js {
                        root   /web//blog;}
      location /background {
                        root   /web/blog;}
      location /file {
                        root   /web/blog;}
      location /theme {
                        root   /web/blog;}
      location /avatar {
                        root   /web/blog;}
      location /stats {
                        root   /web/blog;}
      location / {
             try_files $uri $uri/ @laconica;}
       location @laconica {
             rewrite ^(.+)$ /index.php?p=$1 last;   }
      location ~ \.php$ {
            root   /web/blog;
            sendfile on;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_indexindex.php;
            fastcgi_paramSCRIPT_FILENAME/web/blog$fastcgi_script_name;
            include      fastcgi_params;
                }
          }
2、原因:Pear和 Net 组件对utf-8的支持有bug,并且源代码中还有两处需要修改才能完美支持中文utf-8编码。
   (1)classes/Notice.php:100行。
   (2)lib/util.php:407、414添加(*UTF8)
       以上两处解决产生中文tag和显示的问题。
   (3)extlib/Net/URL/Mapper/Part.php:137行,解决不能在中文tag产生“/tag/测试”的URL问题。
   (4)extlib/Net/URL/Mapper/Path.php:164行,解决中文tag路径不能访问的问题
3、进一步的改进:中文组名。
4、原因:bsd下的pcre有别于某些版本下的linux环境。在BSD中,pcre默认不会使用utf-8的编码匹配。但是在php5.2.8以前版本中,自带的pcre却可以。
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38866/showart_2130282.html
页: [1]
查看完整版本: BSD下statusnet的中文tag修正