Using German sharp S (ß) with Bitstream Charter and XeLaTeX
Contrary to other font packages, XCharter.sty
does not distinguish being called by pdflatex
or XeLaTeX+fontspec
, so it ends up into defining legacy fonts, using the T1 encoding.
In the T1 encoding, the slot corresponding to ß in Latin-1 (which is respected by UTF-8) has the uppercase form “SS” of the eszet. This is why you get that strange output.
On the other hand, XCharter is available in TeX Live in OpenType format. Depending on your system, you can get away with
\setmainfont{XCharter}
(if the OpenType fonts in TeX Live are made available to the operating system) or you need to specify the associations explicitly
\setmainfont{XCharter}[
Extension=.otf,
UprightFont=*-Roman,
ItalicFont=*-Italic,
BoldFont=*-Bold,
BoldItalicFont=*-BoldItalic,
]
Don't load XCharter.sty
along with XeLaTeX or LuaLaTeX.
Use pdflatex
with \usepackage[utf8]{inputenc}\usepackage{xcharter}
or xelatex
with \usepackage{fontspec}\setmainfont{XCharter}
. Both work (the font exists in opentype format):
\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage{xcharter}
\usepackage{fontspec}
\setmainfont{XCharter}
\begin{document}
Text: ä ö ü ß
\end{document}