LaTeX and special/chinese unicode characters

Problem:

You want to create a pdf file (with latex) containing some chinese characters.

Solution:

My initial idea was that enabling UTF-8 will suffice to include any chinese character to the output pdf:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
你好
\end{document}

however after getting many “Unicode char … not set up for use with LaTeX” errors, I wondered if this would be the right idea. Instead use:

sudo apt-get install latex-cjk-all

to install the latex asian character support packages. The following code will then work, to create a pdf with chinese characters:

\documentclass[UTF8,nofonts,10pt,a4paper]{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
你好
\end{CJK}
\end{document}