Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've tried to use the pst-barcode to generate QR codes, and ran into an issue with foreign characters.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pst-barcode}

\begin{document}
\begin{pspicture}(1in,1in)
  \psbarcode{ÆØÅæøå}{width=1.0 height=1.0}{qrcode}
\end{pspicture}
ÆØÅæøå
\end{document}

Incorrect (and complex) QR code
Incorrect (and complex) QR code

This does not give the expected (or wanted) result. Removing the \usepackage[utf8]{inputenc} solves the pst-barcode problem:

\documentclass{article}
\usepackage{pst-barcode}

\begin{document}
\begin{pspicture}(1in,1in)
  \psbarcode{ÆØÅæøå}{width=1.0 height=1.0}{qrcode}
\end{pspicture}
ÆØÅæøå
\end{document}

Correct QR code, but wrong encoding for text in LaTeX
Correct QR code, but wrong encoding for text in LaTeX

However, this breaks the input encoding of LaTeX... I presume that pst-barcode does not support UTF8.

What would be the best way to get both UTF-8 encoded LaTeX and correct QR codes for foreign characters?

share|improve this question
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. You can include the images but remove the ! before them, then one with enough reputation can append it for them to appear inline. –  N.N. Jan 27 '12 at 14:53
    
Thanks @N.N., understood - I now added the QR Code images. –  Per Jakobsen Jan 28 '12 at 12:48

1 Answer 1

inputenc redefines the foreign characters to actually be commands that generate the correct glyphs, but this does not work within \psbarcode. You must give the parse option, and then specify the characters by their three-digit ASCII code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pst-barcode}
\begin{document}
\begin{pspicture}(1in,1in)
  \psbarcode{^198^216^197^230^248^229}{width=1.0 height=1.0 parse}{qrcode}
\end{pspicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.