How to write special character (~) in a URL in a bibliography [duplicate]

I am writing a URL in a web reference in latex. The link contains this special character ~ that when I compile the tex file to PDF, it disappear. The link becomes invalid.

How can I add the special character (~) to my URL in latex reference file (.bib)?

EDIT: The solution of using \url{} will not work with me as this is not a text URL but a bibliography. Here is the script. I use IEEE conference template.

\documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}
\begin{document}
\title{Test}
\maketitle

This is \cite{citeme}.

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,ref}
\end{document}


The ref file is:

%%
%% WinShell 3.3.2.6
%% http://www.winshell.org/
%%

% Strings

% Preamble

% BibTeX Entries
@misc{citeme,
author               = {MyName},
title                = {XYZ},
url                  = {https://www.xxx/~vvv},
year                 = {2014},
}


The output as shown below does not include the ~ sign in the URL which make it unreachable link when clicked from the PDF.

marked as duplicate by Mensch, marmot, Zarko, Stefan Pinnow, TeXnicianJan 8 '18 at 5:25

• Welcome to TeX SX: Load the url package, and use \url{...}. – Bernard Jan 7 '18 at 0:43
• Thanks. I did. I use misc as a type of the reference. I used \url{...} in the url field. I got the URL correct with the special character. However, the \url{} appears in the copiled version in the PDF surrounding the URL. Where should I place the \url{myurl}? – anonymous Jan 7 '18 at 1:43
• You shouldn't need \url{} in a url field if you're using a suitable style and encoding etc. Biblatex is easiest, as @Bernard says, but there are BibTeX styles which can handle a url field correctly. However, we don't currently know anything about your code except that it doesn't do what you want. So it is hard to say much. Posting an MWEB would probably get you more effective help. – cfr Jan 7 '18 at 1:56
• I tried your MWE, and adding Bernard's\cfr's suggestions, it works fine here. That is, you already included your url in the url field. But you didn't load the package. So add \usepackage{url} to your preamble. If you want it to be clickable, add hyperref instead. – gusbrs Jan 7 '18 at 19:08
• @gusbrs IEEEabrv is actually a .bib file with journal abbreviations, so \bibliography is just fine. – user36296 Jan 7 '18 at 22:34