# Converting TeX with emoji in HTML using make4ht

I have a TeX document with emojis and I want to convert it into HTML using make4ht. Most of the emojis are not present in the final HTML.

The problem might be reproduced using the example provided here: Smileys in LaTeX

Compiling with:

make4ht -u -x emoji


where the content of file emoji.tex is:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\DejaSans{DejaVu Sans}

\begin{document}
Some emoticons from Unicode:

{\DejaSans ☺😐☹😁😂😃😇😉😈😋😍😱} and even cats: {\DejaSans 😺}!
\end{document}


The resulting HTML shows:

while the PDF shows:

How to fix it and get all emojis in the HTML?

Not all characters work out of the box in the XeTeX mode. Only Latin with most of diacritics works by default. It is because every supported character is turned into macro and that outputs special instruction for TeX4ht.

You can activate more characters using the \xeuniuseblock command. It activates selected. Unicode block. You can use the following configuration file for the Emoji support:

\Preamble{xhtml}
\xeuniuseblock{Emoticons}
\begin{document}
\EndPreamble


It now works even with XeTeX mode:

make4ht -x -c mycfg.cfg emoji


• I got the following result: â˜ºðŸ˜â˜¹ðŸ˜ðŸ˜‚ðŸ˜ƒðŸ˜‡ðŸ˜‰ðŸ˜ˆðŸ˜‹ðŸ˜ðŸ˜± and even cats: ðŸ˜º!  – LEo Feb 11 at 12:11
• @LEo does the -u option fix it? – michal.h21 Feb 11 at 12:29
• @michal-h21 yes ... is it always necessary? – LEo Feb 11 at 13:23
• It isn't necessary in up-to-date make4ht, but in your case probably is – michal.h21 Feb 11 at 13:27

make4ht --help says -u is obsolete, I get the same as you with -x (xetex) but with -l (luatex) I get

make4ht -l emoji


Note that the generated html isn't forcing the same fonts but with lualatex make4ht is letting the characters through and then general CSS fallback rules mean that these are being rendered by the first system installed font that has the characters (which is Segoe UI Emoji on this machine)