I have the following MWE, and I get the output I wish, but for a single trick: i need to have some extra '\' in front of the worrysome characters '├─ ', '│', ecc.. Without the '\' in front, things are rendered all messed up. Questions are: why so? is there a quick fix?
\documentclass[titlepage,a4paper,12pt]{article}
\usepackage{xcolor}
\usepackage{listings}
% \usepackage{listingsutf8} <--- Not needed
\usepackage[utf8]{inputenc}
\usepackage{pmboxdraw} <--- Needed
\lstset{
language=bash,
basicstyle=\ttfamily\small,
numberstyle=\footnotesize,
numbers=left,
backgroundcolor=\color{gray!10},
frame=single,
tabsize=2,
rulecolor=\color{black!30},
literate=
{│}{\textSFxi}1%
{┐}{\textSFiii}1%
{└}{\textSFii}1%
{┴}{\textSFvii}1%
{┬}{\textSFvi}1%
{├}{\textSFviii}{1}%
{─}{\textSFx}1%
{┼}{\textSFv}1,
title="My Folder",
escapeinside={\%*}{*)},
% breaklines=true,
% breakatwhitespace=true,
framextopmargin=2pt,
framexbottommargin=2pt,
extendedchars=false,
% inputencoding=utf8
commentstyle=\mycommentstyle,
escapechar=\$,
}
\newcommand{\mycommentstyle}[1]{\normalfont\rmshape{ $\leftarrow $ #1}}
\begin{document}
\begin{lstlisting}
\ ├── jsdom_demo-master $\mycommentstyle{I need normal font here}$
\ │ ├── dummy.html
\ │ ├── jquery-1.7.1.min.js
\ │ ├── README.md
\ │ └── transform.js
1 directories, 4 files
\end{lstlisting}
\end{document}
EDIT ABOVE FIXEX IT! THANKS TO WHOEVER MADE A COMMENT
\usepackage{listingsutf8}is doing nothing: per the package manual,listingsutf8only modifies thelistinputlistingenvironment and does not change thelstlistingenvironment you are using. Your UTF8 character therefore is just breaking thelistingspackage exactly like the author say it would on page 15 of the manual. – Willie Wong Sep 04 '19 at 21:15