biblatex, using space in url doesnt work

You could redefine the url bibmacro to use urlraw instead of url:

\documentclass{article}

\PassOptionsToPackage{obeyspaces}{url}%
\usepackage[backend=biber,sorting=nyt,style=alphabetic]{biblatex}
\usepackage{hyperref}
\bibliography{test}

\renewbibmacro*{url}{\printfield{urlraw}}
\begin{document}
 \cite{mean_well_rcp-1600_2018}
 \url{C:/Test Folder/file}
 \printbibliography
\end{document}

enter image description here


C:/Test Folder/file is quite an unusual URL for a bibliography, but of course that may just be for the example. If it is not, though, you may want to look into the file field, it is not used by any of the standard styles, but it would be the semantically sound decision.

Biber escapes URLs into percent encoding. If you don't want that you can show the urlraw field instead, see How to disable percent-encoding in URLs?.

\documentclass{article}
\usepackage[backend=biber,sorting=nyt,style=alphabetic]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{mean_well_rcp-1600_2018,
  langid     = {english},
  title      = {RCP-1600 series},
  url        = {C:/Test Filder/file},
  shorttitle = {RCP-1600},
  date       = {2018-01-15},
  author     = {MEAN\textasciitilde{}WELL}
}
\end{filecontents}

\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{\thefield{urlraw}}}

\addbibresource{\jobname.bib}
\begin{document}
 \cite{mean_well_rcp-1600_2018}
 \url{C:/Test Folder/file}
 \raggedright
 \printbibliography
\end{document}

The URL in the bibliography now displays as <code>C:/Test Folder/file</code>

You can be a bit safer and link to the encoded version while showing the unencoded version with

\DeclareFieldFormat{url}{%
  \mkbibacro{URL}\addcolon\space
  \ifhyperref
    {\href{#1}{\nolinkurl{\thefield{urlraw}}}}
    {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter
     \nolinkurl
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\expandafter
     {\thefield{urlraw}}}}

Note that the langid field should contain a language name known to babel or polyglossia. Englisch is not a valid language name in that context, you probably want english.


A file path can't be a valid URL. So, in your bib entry, don't use the url field to store a file path!

First solution (using eprint and eprinttype fields)

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{mean_well_rcp-1600_2018,
 langid = {Englisch},
 title = {RCP-1600 series},
 eprint = {C:/Test Folder/file},
 eprinttype= {raw},
 shorttitle = {RCP-1600},
 date = {2018-01-15},
 author = {MEAN\textasciitilde{}WELL}
}
\end{filecontents*}

\usepackage[backend=biber,sorting=nyt,style=alphabetic]{biblatex}
\usepackage{hyperref}

\DeclareFieldFormat{eprint:raw}{%
  Path\addcolon\space\texttt{#1}%
}

\addbibresource{\jobname.bib}
\begin{document}
 \cite{mean_well_rcp-1600_2018}

 \printbibliography
\end{document}

enter image description here

Second Solution (using file field)

(form this answer)

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{mean_well_rcp-1600_2018,
 langid = {Englisch},
 title = {RCP-1600 series},
 file = {C:/Test Folder/file},
 shorttitle = {RCP-1600},
 date = {2018-01-15},
 author = {MEAN\textasciitilde{}WELL}
}
\end{filecontents*}

\pagestyle{empty}

\usepackage[backend=biber,sorting=nyt,style=alphabetic]{biblatex}
\usepackage{hyperref}

\DeclareFieldFormat{file}{%
  \bibstring{file}\addcolon\space\texttt{#1}%
}
\renewbibmacro{finentry}{%
  \finentry\addspace
  \printfield{file}%
}

\addbibresource{\jobname.bib}
\begin{document}
 \cite{mean_well_rcp-1600_2018}

 \printbibliography
\end{document}