thiemowmde added a comment.
Yes, I believe so. Short answer: It's not Wikibase, it's MediaWiki.
https://phabricator.wikimedia.org/diffusion/EWBA/browse/master/repo/includes/Validators/UrlSchemeValidators.php$53
https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/parser/Parser.php$95
As of now, Wikibase intentionally blacklists the same characters in URLs that
are also blacklisted when using URLs in wikitext. The reason square brackets
are blacklisted is MediaWiki's URL syntax: `[http://example.com label]`.
Prominent help pages like https://en.wikipedia.org/wiki/Help:URL explain how to
work around this limitation: replace `[` and `]` with `%5B` and `%5D`.
Since what is stored in the Wikibase database is not wikitext, it would be
possible to lift this limitation – in theory. We could even allow whitespace,
for example. However, this requires us to encode these characters when the
value is used. And that might be the main problem: we don't own most of the
code that consumes Wikibase data. Allowing square brackets might result in 3rd
party tools outputting broken wikitext.
The formatters Wikibase itself provides could be updated to support a larger
character set:
https://phabricator.wikimedia.org/diffusion/EWBA/browse/master/lib/includes/Formatters/WikibaseValueFormatterBuilders.php$328
There is a StringFormatter in this code that does **not** do any escaping
(denoted with a comment). This would need to be replaced with a formatter that
escapes just the right characters, just the right way, to result in an URL the
MediaWiki parser can understand. In theory, this means replacing all characters
that are blacklisted in the MediaWiki parser with their `%…` hex escape
sequence. However, I'm not sure if this can safely be done in all cases. It
might as well result in broken URLs.
Unfortunately, most consumers don't use the Wikibase fomatters.
TASK DETAIL
https://phabricator.wikimedia.org/T214300
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: thiemowmde
Cc: Michael, Lydia_Pintscher, thiemowmde, Jc86035, Pigsonthewing, Aklapper,
Biaoo, Philoserf, darthmon_wmde, Nandana, Lahi, Gq86, GoranSMilovanovic,
QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, Hydriz,
aude, Mbch331, Jay8g
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs