I found a solution here
http://mrpmorris.blogspot.mx/2012/08/asp-mvc-encoding-route-values.html
but its complicated
That's because the problem you are attempting to solve is complicated. You may take a look at the following blog post
from Scott Hanselman in which he explains the various challenges in doing this. I will summarize his conclusion:
After ALL this effort to get crazy stuff in the Request Path, it's
worth mentioning that simply keeping the values as a part of the Query
String (remember WAY back at the beginning of this post?) is easier,
cleaner, more flexible, and more secure.
So basically if your ids can contain any characters, they should be passed as query string parameters and not part of the Uri path.
But if you insist and want to have the ids as part of the Uri path you may be inspired by how StackOverflow does it. Look at the address bar of your browser now. You will see this:
https://stackoverflow.com/questions/15697189/special-characters-in-actionlink-asp-mvc
Notice how the url contains 2 tokens: the actual id and a SEO friendly name. Jeff Atwood showed a sample filter function
they are using to generate those SEO friendly slugs. The slug is just for SEO purposes. You could replace it with whatever you want and get the same result:
https://stackoverflow.com/questions/15697189/foo-bar