# Remove underscores from filename

I am using currfile package to get the file name. My file name has the form

"code blah blah blah.tex"

what is being displayed is

"code_blah_blah_blah.tex"

How can I remove the underscores?

Here is the code

\documentclass[twoside,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{babel}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

\makeatletter

\usepackage[T1]{fontenc}
\usepackage{currfile}

\newcommand{\fileName}{\currfilebase}

\pagestyle{fancy}
\fancyhf{}

\makeatother

\begin{document}
Test
\end{document}


Here is the output

• An example, please. – egreg Jul 15 '16 at 8:53
• is it really an underscore or the verbatim visible space character (which has short uprights at either end) – David Carlisle Jul 15 '16 at 9:09
• There are no underscores in my output: i.imgur.com/MQXAxTP.png – alwaysask Jul 15 '16 at 9:14
• No, there is not. At least not in the output on my machine. Did you clicked the link I gave you above? Where do you see the underscores? Even copying the text from pdf reveal no underscore. Please show us the output on your machine (edit your question and add it there). – alwaysask Jul 15 '16 at 9:28
• texlive returns the filename surrounded by quotes if there are spaces, so I can not reproduce. Can you add \typeout{JOBNAME=\jobname} to your document, and show the log output from that, I get JOBNAME="aaa bbb ccc" from a file called aaa bbb ccc.tex – David Carlisle Jul 15 '16 at 11:31

This MWE works for me:

\documentclass[twoside,english]{article}
\usepackage[T1]{fontenc}
%\usepackage[latin9]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{babel}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}
\usepackage{currfile}
\usepackage{xstring}

\newcommand{\fileName}{\currfilebase}

\pagestyle{fancy}
\fancyhf{}