I am trying to read a list of URLs from a file and create QR codes for them. If they contain a # like in the example, I get an
Illegal parameter number in definition of \qr@texttoencode
error. Is it possible to make this work without having to edit the input file and escape the special characters there?
\documentclass{article}
\usepackage{qrcode}
\begin{filecontents}{urls.txt}
http://example.org/foo#bar
\end{filecontents}
\def\loadurls#1{%
\newread\file
\openin\file=#1
\begingroup\endlinechar=-1
\loop\unless\ifeof\file
\read\file to \fileline
\qrcode{\fileline}
\repeat
\endgroup
\closein\file
}
\begin{document}
\loadurls{urls.txt}
\end{document}


\catcode35=11and\ifx\fileline\empty\else\qrcode{\fileline}\fiare necessary. Sorry for the overcomplicated suggestion. – Apr 25 '21 at 19:17