歡迎您光臨本站 註冊首頁

shtml頁面顯示亂碼

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

shtml頁面顯示亂碼

最近公司遷移網站,將原來在windows上運行tomcat遷到linux平台下,遷過來之後大部份正常,就是shtml頁面顯示亂碼,按照網上說的把tomcat開啟ssi功能后仍然亂碼,把該shtml頁面交由apache處理也是一樣亂碼。

root@localhost conf]# grep 'shtml' httpd.conf -5   apache的配置
<IfModule mime_module>
    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

</IfModule>
<VirtualHost *:80>
    ServerAdmin dfdsa@sunand.org.cn
    DocumentRoot "/opt/tomcat_gw/webapps/ROOT/"
    ServerName  www.sunand.org.cn
    ErrorLog "logs/sunand-error.log"
    CustomLog "logs/sunand-access.log" common
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass /test.html !
    ProxyPass /sd_kc/exam/index.shtml !
    ProxyPass / http://219.22.27.18:8080/
    ProxyPassReverse / http://219.22.27.18:8080/
    <Directory "/opt/tomcat_gw/webapps/ROOT/">
    Options -Indexes Includes
    AllowOverride None
    Order allow,deny
    Allow from all
   </Directory>
</VirtualHost>

以下是tomcat的配置,vi web.xml

<servlet>
        <servlet-name>ssi</servlet-name>
        <servlet-class>
          org.apache.catalina.ssi.SSIServlet
        </servlet-class>
        <init-param>
          <param-name>buffered</param-name>
          <param-value>1</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>expires</param-name>
          <param-value>666</param-value>
        </init-param>
        <init-param>
          <param-name>isVirtualWebappRelative</param-name>
          <param-value>0</param-value>
        </init-param>
<init-param>
        <param-name>inputEncoding</param-name>
        <param-value>utf-8</param-value>
</init-param>
<init-param>
        <param-name>outputEncoding</param-name>
        <param-value>utf-8</param-value>
</init-param>
        <load-on-startup>4</load-on-startup>
    </servlet>
<servlet-mapping>
        <servlet-name>cgi</servlet-name>
        <url-pattern>/cgi-bin/*</url-pattern>
    </servlet-mapping>
《解決方案》

樓主的apache默認的編碼是什麼?在客戶機上手動換下編碼看看
如果手動切換亂碼能解決,可以修改apache的默認編碼
《解決方案》

在瀏覽器中調成bg2313  utf-8都不成。apache沒有默認編碼,從2.0以後的版本中apache都是告內容協商來決定編碼的。
《解決方案》

在shtml的文件頭加上html編碼看看

[火星人 ] shtml頁面顯示亂碼已經有506次圍觀

http://coctec.com/docs/service/show-post-15484.html