刚才我又仔细核对了临时服务器上生成 html 代码,发现和 Debian 官方网站相比,在 head 里面,缺少了指定 UTF-8 的一行 meta。

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

看了下 Makefile 里面编译 html 脚本:

#######################################################################
# $ make html      # update all HTML in $(TMPDIR)
#######################################################################
.PHONY: html
html:   $(foreach LX, $(LANGALL), $(TMPDIR)/index.$(LX).html)

$(TMPDIR)/index.%.html: $(MANUAL).%.xml $(ENT_ALL)
        @$(call check-command, xsltproc, xsltproc)
        -mkdir -p $(TMPDIR)
        $(XPINC)   --stringparam base.dir $(TMPDIR)/ \
                --stringparam html.ext .$*.html \
                $(DXSL)/style-html.xsl $<

html 的生成,只与上述命令相关。

查看编译过程中用到的文件 ./xslt/style-html.xsl,

<!-- Since I use xsltproc (not saxon), this is workaround to ensure UTF-8 -->
<xsl:template xmlns="http://www.w3.org/1999/xhtml";
name="head.content.generator">
  <xsl:param name="node" select="."/>
  <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</xsl:template>

里面已经有了指定字符编码为 UTF-8 的 meta 行.

在编译过程中,是 docbook-xsl 这个包,负责 xml 到 html 的格式转换:“stylesheets for
processing DocBook XML to various output formats”

比较 Debian官方网站和临时服务器上生成的 html 源代码,也发现了 docbook-xsl 版本的不同:

Debian官方网站上,用于编译的 docbook-xsl 版本是 1.79.1: "DocBook XSL Stylesheets V1.79.1"

而临时服务器上,这个包比较旧,版本是 1.76.

后单独对这个包进行升级,重新编译,生成的 html 文件里面,已经包含如下这行:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

用 Firefox 浏览器打开,页面正常,问题解决。


<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";><html
xmlns="http://www.w3.org/1999/xhtml";>  <head>    <title>Debian
参考手册</title>    <link rel="stylesheet" type="text/css"
href="debian-reference.css
<view-source:http://58.215.181.118/debian-reference/tmp/debian-reference.css>"/>

    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>

*    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>*

    <link rel="home" href="index.zh-cn.html
<view-source:http://58.215.181.118/debian-reference/tmp/index.zh-cn.html>"
title="Debian 参考手册"/>    <link rel="next" href="pr01.zh-cn.html
<view-source:http://58.215.181.118/debian-reference/tmp/pr01.zh-cn.html>"
title="序言"/>  </head>

非常感谢大家反馈问题哈!

atzlinux


在 2016年8月8日 下午12:14,Faris Xiao <atzli...@gmail.com>写道:

> 每个 html 文件头部,都有说明是 UTF-8。我使用 chrome ,IE,没有出现乱码的现象。可能是 firefox 设置或者对 xml
> 标签识别出现了异常。
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
> http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
>   <head>
>
> 在 2016年8月7日 上午11:47,Zexuan Luo <spacewander...@gmail.com>写道:
>
>> 用脚本去自动化解决中英文排版规范,而不是靠肉眼去挑刺,这个思路赞一个。
>>
>> 随便一提,
>>
>> http://58.215.181.118/debian-reference/tmp/index.zh-cn.html
>>
>> 这个链接我用firefox打开是乱码,需要手动设置编码。貌似需要更新下charset的设置?有其他人也遇到同样的问题吗?
>>
>> 在 2016年8月5日星期五 UTC+8上午10:54:41,Faris Xiao写道:
>>>
>>> 在翻译过程中,不断进行中英文的标点符号转换,有点麻烦,费时间。
>>>
>>> 后续我们再统一用脚本自动转化下中英文标点符号吧。大家在翻译过程中,对标点符号酌情处理即可。
>>>
>>>
>>> ---------- 已转发邮件 ----------
>>> 发件人: rainysia <rain...@gmail.com>
>>> 日期: 2016年8月4日 下午6:44
>>> 主题: Re: [gzlug] Debian 参考手册 翻译 项目征集志愿者
>>> 收件人: Faris Xiao <atzl...@gmail.com>
>>>
>>>
>>> 这里有一些工具关于 全角半角和中文排版的.
>>> https://github.com/sparanoid/chinese-copywriting-guidelines
>>>
>>> 我以前写了一个shell脚本来处理 全角转半角.
>>> https://github.com/rainysia/punctuation_cn_to_en
>>>
>>> 2016-08-04 18:32 GMT+08:00 Faris Xiao <atzl...@gmail.com>:
>>>
>>>>
>>>> 今天把 zh-cn.po 文件里面, msgid 以 "<literal> 开头,又以 </literal>
>>>> 结尾的字符串,写了一个脚本进行批量处理。
>>>> 将其 msgstr 内容设置和 msgid 一样。这类字符串,主要是linux命令,不需要翻译的.
>>>>
>>>> 期间遇到了 & \ 等特殊字符,手工进行了处理.
>>>>
>>>> 刚才已经提交到 git.目前在 weblate 上,会将其记录为 " 源字符串与已翻译字符串相同",后续再逐步校对吧.
>>>>
>>>> BTW:大家在翻译字符串的时候,注意在汉字和英文单词之间,加一个半角英文空格吧.目前大部分的翻译项目,都是这样做的.编译出来的文档,会美观些.
>>>>
>>>> atzlinux
>>>>
>>>
>>> --
>> 您收到此邮件是因为您订阅了Google网上论坛上的“广州 GNU/Linux 用户组”群组。
>> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到gzlug+unsubscr...@googlegroups.com。
>> 要发帖到此群组,请发送电子邮件至gzlug@googlegroups.com。
>> 访问此群组:https://groups.google.com/group/gzlug。
>> 要查看更多选项,请访问https://groups.google.com/d/optout。
>>
>
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“广州 GNU/Linux 用户组”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到gzlug+unsubscr...@googlegroups.com。
要向此群组发帖,请发送电子邮件至 gzlug@googlegroups.com。
访问此群组:https://groups.google.com/group/gzlug。
要查看更多选项,请访问 https://groups.google.com/d/optout。

回复