2

This question already has an answer here:

I created a list in the en site called

hello's~`!@#$%^&*(){}[]:;"'<>?/\|*-+.

What I am trying to do is figure out what exactly is the encoded version of the name if I am trying to target it by name in a REST url. I have this

http://mysite/en/_api/web/lists/getbytitle('hello's~`!@#$%^&*(){}[]:;"'<>?/\|*-+.')

but this doesn't work of course. I tried url encoding it to

http://mysite/en/_api/web/lists/getbytitle('hello%27s~%60!%40%23%24%25%5E%26*()%7B%7D%5B%5D%3A%3B%22%27%3C%3E%3F%2F%5C%7C*-%2B.')

but even then, doesn't work.

Does anyone know how to do it?

marked as duplicate by Robert Lindgren Dec 18 '15 at 7:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I think you have not encoded that last .. But still wondering why such an odd name :). – Asad Refai Dec 18 '15 at 3:46
  • I just want to figure out a way to make sure that no matter what the user types for a name of a list, then I will be able to target it with rest, so this is just an extreme test basically. – omega Dec 18 '15 at 3:47
  • Cool try this hello%27s%7E%60%21%40%23%24%25%5E%26%28%29%7B%7D%5B%5D%3A%3B%22%27%3C%3E%3F%2F%5C%7C-%2B. – Asad Refai Dec 18 '15 at 3:48
  • it says invalid url. – omega Dec 18 '15 at 3:50
  • hi omega, am just curious to know why did you create a list with that name? – Mohamed Derhalli Dec 18 '15 at 5:26
6

Try using encodeURIComponent to encode the list title. However, encodeURIComponent does not encode apostrophe. For apostrophes use %27 twice or two apostrophes ''. See this for more detail: http://www.sharepointnadeem.com/2012/06/special-characters-in-rest-query-filter.html

Not the answer you're looking for? Browse other questions tagged or ask your own question.