Wrong ending single quote with \grq under XeLaTeX

I'm experiencing a glyph issue when using \grq from the german package under xelatex.

\documentclass{article}

\usepackage{libertine}
\usepackage{german}

\begin{document}
\glq test\grq
\end{document}


xelatex outputs the wrong ending quote throwing a font warning:

LaTeX Font Warning: Font shape 'OT1/LinLibertine(0)/m/n' undefined (Font) using 'OT1/cmr/m/n' instead (Font) for symbol 'grq' on input line 7.

However, it should rather look like this, and pdflatex does it right:

Any idea what is going wrong?

You shouldn't be using the german package that's obsolete and present only for compatibility with older documents.

However, the problem is present also with babel. I'll add the code for working around the issue.

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{libertine}
\usepackage{ifxetex}

\ifxetex
\DeclareTextSymbol{\glq}{\encodingdefault}{"201A}
\DeclareTextSymbol{\grq}{\encodingdefault}{"2018}
\DeclareTextSymbol{\glqq}{\encodingdefault}{"201E}
\DeclareTextSymbol{\grqq}{\encodingdefault}{"201C}
\fi

\begin{document}

\glq test\grq

\glqq test\grqq

\end{document}


Note, though, that you can input the characters directly, if you're using XeLaTeX:

‚test‘

„test“


The output would be the same.

• Great, many thanks! Yes, I'm revisiting an older document that is stuffed with \glq \grq. In fact, I'm using polyglossia with babelshorthands, but unfortunately the single quotes are not (yet?) included. Does it mean that with your modifications I can do without the german package? – Timm Jul 9 '15 at 19:56
• @Timm You should do without the german package. – egreg Jul 9 '15 at 19:58