3

If you query the wikipedia api for c# with a url such as:

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=jsonfm&titles=c%23

The response removes the %23 / # and turns it into just C, and displays results for C itself.

The response has this node in the json:

"normalized": [
    {
        "from": "c#",
        "to": "C"
    }

How do you stop the normalization of special characters with the MediaWiki API?

mariocatch
  • 8,305
  • 8
  • 50
  • 71
  • 1
    I don't think you can. Wikipedia prohibits certain characters from titles and `#` is one of them. See [this](https://en.wikipedia.org/wiki/Wikipedia:Naming_conventions_(technical_restrictions)#Forbidden_characters) – DavidG Jun 01 '16 at 23:24
  • @DavidG Thanks, I couldn't find that on the MediaWiki docs. If you'd like to answer with this, I can mark it as the answer unless someone comes and proves otherwise :) – mariocatch Jun 01 '16 at 23:36
  • Not sure it's a real answer to be honest, happy to just leave it as a comment! I just did a bit of Google-fu and found that link :) – DavidG Jun 01 '16 at 23:37
  • 1
    @DavidG You answered the question, so I think it's fair you get the credit. And if anyone finds this question in the future, it's better if the answer is clearly visible as an answer, and not hidden in the comments. – svick Jun 06 '16 at 17:01
  • @svick Well since you asked so nicely :) – DavidG Jun 08 '16 at 01:58

1 Answers1

2

You can't stop the normalisation of your search queries as Wikipedia prohibits certain characters from article titles.

From the Wikipedia docs:

Due to clashes with wiki markup and HTML syntax, the following characters are NOT allowed to be part of page titles (nor are they supported by DISPLAYTITLE):

# < > [ ] | { }

Community
  • 1
  • 1
DavidG
  • 113,891
  • 12
  • 217
  • 223