Underscore in bibtex url

Just to formally answer and close this question: As Ulrike Fischer answered in the comments, the solution was to use \usepackage{hyperref} (or \usepackage[hidelinks]{hyperref} to avoid the ugly boxes) and \usepackage[T1]{fontenc}. This allows properly clicking and copy-&-pasting URLs with underscores.

However, it turned out, using package hyperref wasn't allowed when trying to submit the paper to IEEE. So I ended up simply changing the URL to something without underscore using goo.gl (or bitly since goo.gl is down).


In case of IEEE templates, when using the file bib, replacing the underscore with {\_} should solve the problem. In the case of the question:

@misc{code,
    title = {Code},
    url = {https://1drv.ms/link{\_}link}
}