# How to handle special characters in URLs while using \href [closed]

Special characters like % throw href off. What package, if any, gives a work around? Would there be a side effect to changing the URLs from % to \%?

EDIT On a second try, on a different computer, I do not see any problems except that TeXworks editor does treat items in a href after % as a comment (and actually so does this web site!) On the first computer I got an error message too. I'll post if I can reproduce it.

\documentclass{article}
\usepackage{hyperref}

\begin{document}
% the original URL
% the modified URL

\end{document}

-

## closed as too localized by Marco Daniel, lockstep, Joseph Wright♦Jun 2 '12 at 21:58

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

If you are using \href from the url package then % is OK so long as the command is not in the argument of another command (that is, the same rules as for \verb) –  David Carlisle May 31 '12 at 12:42
What I see is that TeX treats % as the beginning of a comment even if it is inside a URL address handled by href. I just manually insert a slash behind each. I must be missing something. –  Maesumi May 31 '12 at 13:09
Yes, a mimimal example –  Marco Daniel May 31 '12 at 13:19
LaTeX does not define \href so if you have such a macro it must be defined somewhere, but you have not given any indication of what definition you are using. url package is a common one, but hyperref and many classes also define similar but different versions. –  David Carlisle May 31 '12 at 14:38
1. Using %2 indeed works with hyperref 6.82p, but (if my memories are correct) there are older versions of the package where it does not work. (\listfiles in the preamble of the document will list all files with version info at the end of the log file.) 2. Why don't you use / instead of %2F? That should work with all versions of hyperref, url or whatsoever. 3. Also UltraEdit (13.20a) treats everything after a % as comment, but tex.SE is at least so smart to treat text after \% not as comment. –  Stephen May 31 '12 at 15:42