오늘 내 debian/Lenny의 Apache를 2.2.9 버전으로 업데이트했으며 어떤 이유로 인코딩이 더 이상 올바르지 않습니다.아파치 업데이트 후 Zend 함수가 잘못된 인코딩으로 반환됩니다.
저는 모든 내 페이지와 일부 자바 스크립트에서 UTF-8을 사용하여 일부 로그인을 수행합니다. 이 인코딩 문제는 자바 스크립트를 망치고 프런트 엔드에서 이상한 동작을 만듭니다.
다음은 내 아약스 호출시 내 백엔드가 반환하는 예제입니다. { "d": "http://my.domain.com", "status": true}
내가 돌아 아파치를 강제로 시도
(나는 그들에 몇 가지 숫자와 보통 물음표와 이상한 rectange, 당신은 이상한 문자를 참조 바랍니다) UTF- 8 인코딩 "AddDefaultCharset UTF-8"옵션을 사용하십시오. 나는 내 코드를 전혀 변경하지 않았다.
이 부분을 도와주세요. 더 이상 볼 곳이 어디인지 알려주세요.
여기
NameVirtualHost Myip
<VirtualHost *:80>
DocumentRoot /var/www/domain.com/public
ServerName domain.com
ServerAlias *.domain.com
ServerAdmin [email protected]
RequestHeader edit Host: ^([^.]+)\.my\.domain\.com my.domain.com early
RequestHeader edit Host: ^([^.]+)\.api\.domain\.com api.domain.com early
RequestHeader edit Host: ^([^.]+)\.partners\.domain\.com partners.domain.com early
RequestHeader edit Host: ^([^.]+)\.admin\.domain\.com admin.domain.com early
AddOutputFilterByType DEFLATE text/html text/plain text/xml
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/domain.com/public>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
</Directory>
ErrorLog /var/log/apache2/domain_error.log
CustomLog /var/log/apache2/domain_access.log combined
</VirtualHost>
이 도와 주셔서 감사하고 더 많은 정보가 필요하면 알려 주시기 내 apache2.conf의
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
그리고 내 가상 호스트 구성입니다. 이 문제를 해결할 수 있기를 바랍니다.
왜 HTML 메타 태그 인코딩을 사용하지 않습니까? –
사실 나는 그렇지 않습니다. 문제는 HTML쪽에 있지 않습니다. 그것은 내가 정보를 검색하거나 인코딩이 올바르지 않은 일부 동작을 수행하기 위해 백엔드 호출을 할 때 결과를 올바르게 해석하지 못하게하는 이상한 문자가 추가됩니다. –
여기에 약간의 정밀도가 있습니다. 그것은 renderJSON 함수처럼 보입니다. 저는 아약스로 정보를 보내고 싶습니다. 이상한 문자를 추가하는 것입니다. if ($ this-> ajax) { $ this-> renderJSON (TRUE, array ('d'=> $ redirect)); } –