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

Bruce Dubbs bruce.dubbs at gmail.com
Sun May 18 22:43:27 PDT 2014

Ken Moffat wrote:
> On Sun, May 18, 2014 at 01:28:38PM +0800, Lei Tong wrote:
>> 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 :)
>   Thanks for those extra details - I don't have tidy installed (it
> was a waste of time for my local rendering, and the books get
> rendered on the LFS server), and I didn't bother creating HTML
> tarballs.

Ken, you are pretty much our resident expert on i18n and character 
encoding.  As you mention, all the characters in LFS and BLFS (Except 
Igor's last name) are in ASCII.  Do we need to change the book/Makefile.

   -- Bruce

More information about the lfs-dev mailing list