Error: Unicode char \u8:φ not set up for use with LaTeX
The inputenc
package, even with the utf8
option doesn't load all the Unicode tables. It loads only those for which it knows it will have to typeset some glyphs.
You have then to teach the proper environment, because each Unicode block requires a different TeX fonts (they have only 256 characters).
So your example works with pdflatex
, but modified into the following code.
\documentclass{article}
\usepackage[LGRx,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{CJKutf8}
\begin{document}
\foreignlanguage{greek}{φΔδ}\begin{CJK}{UTF8}{gbsn}汉\end{CJK}
\end{document}
This is admittedly largely impractical for extensive usage of characters belonging to different blocks, so it may be advisable to switch to XeLaTeX or LuaLaTeX that can use OpenType fonts.
Important update
After release of Babel version 3.9, the LGRx
encoding should not be used any more. Now LaTeX is able to interpret correctly UTF-8 characters for Greek out of the box, provided the Greek language is loaded with babel
. So the example above becomes
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{CJKutf8}
\begin{document}
\foreignlanguage{greek}{φΔδ}\begin{CJK}{UTF8}{gbsn}汉\end{CJK}
\end{document}
utf8
for pdflatex
has only a limited subset of Unicode. Use xelatex
with
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Code2000}
%\setmainfont{Arial Unicode MS}
\begin{document}
φΔδ汉
\end{document}
Code2000 can be replaced by another OpenType or TrueType font which has all that characters, eg. Arial Unicode.
This error occurs when the tex editor file encoding and the document file encoding are not the same.
E.g. editor file encoding is ISO-8859-1, and the document has \usepackage[utf8]{inputenc}
command. Change the editor file encoding to UTF-8, and restart the editor.
(It is possible that your editor refers to file encoding as font encoding. For details, see the comments.)