Hi folks -

TL;DNR: Can MediaWiki encode URL fragments in its API responses?

The iOS team noticed the MediaWiki Notifications API returns partially encoded URLs - the paths look to be encoded, but the fragments are not. This causes issues with user talk page notifications with topic title fragments in certain languages:

...
"legacyPrimary": {
    "url": "//ar.wikipedia.org/wiki/%D9%86%D9%82%D8%A7%D8%B4_%D8%A7%D9%84%D9%85%D8%B3%D8%AA%D8%AE%D8%AF%D9%85:Tsevener?markasread=29965554&markasreadwiki=arwiki#غير_جيد",
    "label": "اعرض الرسالة"
}
...

Our Swift URLs (which are based on RFC 1808) fail to instantiate with these unencoded fragments. This led to some cross-team discussion on T307603 about where and how to fix this. Does this seem like something that could (or should) be fixed deeper within MediaWiki? Can we encode the fragments of urls in the response of any MediaWiki API?

@matmarex did some excellent investigation in this comment, and it sounds like the original Chrome bug that led to this unencoded fragment need within MediaWiki is no longer an issue. We're open to fixing it client-side if this proposal is a no-go, but I wanted to make sure we weren't putting in a client-side workaround for a server-side workaround that is no longer needed. I appreciate any thoughts!

Toni Sevener
iOS Software Engineer
Wikimedia Foundation