Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I understand that one should (?) be using UNICODE for html. But using this with tex4ht, always makes "ff" look strange. Why does this happen for "ff"? and based on this test below, should one instead use iso-8859-1 encoding when using htlatex to generate HTML from Latex, or may be I am not using the correct combination of options?

Given this latex file

\documentclass{article}%
\begin{document}
\title{Kamke differential equations}
\maketitle
\end{document}

Here are 5 different htlatex commands: 3 used utf8, one does not use any encoding (default), and finally one uses iso-8859-1. The iso option generated the best result. This is on windows using firefox.

enter image description here

references

http://www.tug.org/applications/tex4ht/mn-commands.html

using texlive 2012 debian to compile latex files.


Update

Result using provided test below is shown in this image. It shows a problem.

I've put the zip file which contains all output and the HTML file in this folder

http://12000.org/tmp/061613/

I am using firefox 20, windows 7

enter image description here

share|improve this question
    
Sorry it's not really possible to say anything given this amount of information. HTML like LaTeX can use UTF-8 or ISO-8859-1 or several other encodings but the encoding declared has to match the encoding used otherwise you get rubbish in the output. For HTML the main place to specify encoding is in the HTTP headers or failing that in a <meta... charset=... meta element in the head. –  David Carlisle Jun 16 '13 at 9:48
    
@DavidCarlisle what other information would you like me to show in the above? The HTML header generated for the above cases? I am simply trying to find out which option I should be using. –  Nasser Jun 16 '13 at 9:52
    
related: en.wikipedia.org/wiki/Typographic_ligature –  matth Jun 16 '13 at 9:59
3  
If I use htlatex aa11.tex "htm,uni-html4" " -cunihtf-utf8" The generated htm(l) file is declared as utf8, but in all cases ff is encoded (and rendered correctly) as ff Can you put a sample that renders incorrectly on a web site somewhere so it shows what encoding you declare in the http headers –  David Carlisle Jun 16 '13 at 10:07
add comment

1 Answer

up vote 8 down vote accepted

As to the “why” question, what is happening here is that under some circumstances the letter pair “ff” is replaced by “ff” LATIN SMALL LIGATURE FF U+FB00, which is understandable in a sense, but then things go wrong.

In cases 3 and 4, the character is presumably written correctly in the HTML document, but the font being used does not contain it, so the browser picks up a glyph from a backup font. The probably depends on font settings, which were not disclosed in the question.

In case 2, the character is written as UTF-8 encoded, bytes 0xEF 0xAC 0x80, but then these bytes get interpreted according to windows-1252, yielding “ff”. The reason is that the character encoding has been declared incorrectly, or maybe not at all, forcing browsers to guess, and they may guess wrong.

Using U+FB00 is understandable but questionable. Such characters used to be the only way to use ligatures in HTML document, but they only work when the font used contains them. Nowadays you can use font-feature-settings in CSS, and although they are still relatively poorly supported (in fonts and in browsers), they are safe in the sense that when they fail, e.g. “ff” gets displayed just as “ff”, not in a fancy incorrect way.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.