由 skywx 在 05-08-2003 16:14 发表:
自建的服务器中的网页不能显示中文
我用的是linux9.0自带的apache也就是改名后的httpd2.4.40,建了一个服务器
然后我把我从网上下下来的网页放在服务器的文档目录里面,然后用Mozilla浏览了下
http://172.27.53.100/linux/1.html (172.27.53.100是我的ip)
不过显示的都是乱码,只有在‘查看’--‘字符编码’里面改成‘简体中文(gb2312)’才可显示中文,我在其它windows机器上查看我服务器上的网页,也是乱码。
不过我上网看其它网站的网页,就不存在这样的问题,中文显示很正常,我看了下设置,在‘查看’--‘字符编码’里面自动设制的就是‘简体中文’。而通过我服务器的网页设置却是‘西方(iso-8859-1)’
不知道为什么会这样子的,不知是不是哪儿没有设好啊?
由 黄叶 在 05-08-2003 16:22 发表:
你用的是什么服务器?是apache吗?
你用的是什么服务器?是apache吗?
要是的话,在它的配制文件里,有一个应该修改的地方
那就是:
AddDefaultLanguage GB2312
就行了。
由 skywx 在 05-08-2003 16:32 发表:
对,我用的就是apache,不过它现改了名了,叫httpd了
哦,谢了,我去试试
由 skywx 在 05-08-2003 19:21 发表:
我的配制文件原来有句是:AddDefaultCharset iso-8859-1
我照黄叶兄说的把它改成了:addDefaultCharset gb2312
不过,在网页列表里的文件名可以正常显示中文了,但是只要打开列表里面的网页
网页里面还是乱码
我的配置文件里面字符相关的如下:
DefaultLanguage and AddLanguage allows you to specify the language of
a document. You can then use content negotiation to give a browser a
file in a language the user can understand.
Specify a default language. This means that all data
going out without a specific language tag (see below) will
be marked with this one. You probably do NOT want to set
this unless you are sure it is correct for all cases.
* It is generally better to not mark a page as
* being a certain language than marking it with the wrong
* language!
DefaultLanguage nl 我也改过这句,把#去了后再把nl改成下面提到的zh-tw,tw,gb2312都行不通,还是不能自动显示网页中的中文
Note 1: The suffix does not have to be the same as the language
keyword --- those with documents in Polish (whose net-standard
language code is pl) may wish to use "AddLanguage pl .po" to
avoid the ambiguity with the common suffix for perl scripts.
Note 2: The example entries below illustrate that in some cases
the two character 'Language' abbreviation is not identical to
the two character 'Country' code for its country,
E.g. 'Danmark/dk' versus 'Danish/da'.
Note 3: In the case of 'ltz' we violate the RFC by using a three char
specifier. There is 'work in progress' to fix this and get
the reference data for rfc1766 cleaned up.
Danish (da) - Dutch (nl) - English (en) - Estonian (et)
French (fr) - German (de) - Greek-Modern (el)
Italian (it) - Norwegian (no) - Norwegian Nynorsk (nn) - Korean (kr)
Portugese (pt) - Luxembourgeois* (ltz)
Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz)
Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz)
Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
Russian (ru) - Croatian (hr)
AddCharset GB2312 .gb2312 这是我自已加的,没用
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .et
AddLanguage fr .fr
AddLanguage de .de
AddLanguage he .he
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddLanguage pl .po
AddLanguage kr .kr
AddLanguage pt .pt
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pt-br .pt-br
AddLanguage ltz .ltz
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddLanguage zh-tw .tw
AddLanguage hr .hr
LanguagePriority allows you to give precedence to some languages
in case of a tie during content negotiation.
Just list the languages in decreasing order of preference. We have
more or less alphabetized them here. You probably want to change this.
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ltz ca es sv tw
我把tw加到en的前面也不行
ForceLanguagePriority allows you to serve a result page rather than
MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
[in case no accepted languages matched the available variants]
ForceLanguagePriority Prefer Fallback
Specify a default charset for all pages sent out. This is
always a good idea and opens the door for future internationalisation
of your web site, should you ever want it. Specifying it as
a default does little harm; as the standard dictates that a page
is in iso-8859-1 (latin1) unless specified otherwise i.e. you
are merely stating the obvious. There are also some security
reasons in browsers, related to javascript and URL parsing
which encourage you to always set a default char set.
AddDefaultCharset gb2312
Commonly used filename extensions to character sets. You probably
want to avoid clashes with the language extensions, unless you
are good at carefully testing your setup after each change.
See ftp://ftp.isi.edu/in-notes/iana/ass.../character-sets for
the official list of charset names and their respective RFCs
AddCharset GB2312 .gb2312 .gb ;这是我自已加的,也没用
AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5
For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8 .utf8