[lfs-dev] How change charset of html to utf-8

Lei Tong gosaigut at gmail.com
Sat May 17 22:28:38 PDT 2014


Thanks for all your answers. I find that this file tidy.conf decide which
charset to be used on html.
After I changed almost file from encoding="ISO-8859-1" to encoding="UTF-8",
that is , I did this command:

sed -i "s/version=\"1.0\"\ encoding=\"ISO-8859-1\"/version=\"1.0\"\
encoding=\"UTF-8\"/g" `grep version=\"1.0\"\ encoding=\"ISO-8859-1\"
-rl BOOKPATH/`

then those Chinese characters can be show on html pages. But it's not
perfect. Because the charset of html is still iso-8859-1, and Chinese
characters on html page's souece were displayed like these:
为构建

Then I modyfied tidy.conf, changed input-encoding and output-encoding
from latin1 to utf8, as a result, Chinese characters can be showed
normally on both html pages and html page's source.

And then I modified stylesheets/lfs-xsl/chunk-slave.xsl, change from
select="'ISO-8859-1'" to select="'UTF-8'" for some special symbols to
be show. Till now, everything on html for Chinese characters seems
perfect :)



2014-05-18 3:00 GMT+08:00 Alberto Senna Dias Neto <albertosdneto at gmail.com>:

>
>  In the BOOK/ directory (trunk/BOOK), or svn copy trunk/BOOK
>> branches/unicode for any editors who want to try this -
>>
>> find -type f | xargs sed -i 's/encoding="ISO-8859-1"/encoding="UTF-8"/'
>>
>>
> I had this concern before begining translation to Brazilian Portugues, but
> the po tools (xml2po, po4a or itstool) change the encoding of the
> translated xml to utf-8 automatically.
>
> No need to run 'sed' if you use any of those tools, just bring the
> original xml to po, translate, and take the translation into xml again. The
> translated xml will have its encoding changed to utf-8.
> It has been working perfectly with xml2po and worked fine as well with
> po4a.
>
> Once the translation is done, just run 'make'.
>
> --
> Alberto Senna Dias Neto
> albertosdneto at gmail.com
>
> --
> http://lists.linuxfromscratch.org/listinfo/lfs-dev
> FAQ: http://www.linuxfromscratch.org/faq/
> Unsubscribe: See the above information page
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20140518/f79d072d/attachment.html>


More information about the lfs-dev mailing list