Manual:$wgLegalTitleChars/zh

From Linux Web Expert

<translate> Page titles and redirects</translate>: $wgLegalTitleChars
覆盖页面标题中的默认非法字符列表。
<translate> Introduced in version:</translate>1.6.0 (r10960)
<translate> Deprecated in version:</translate>1.41.0 (Gerrit change 942710; git #1552f420)
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(字符串)
<translate> Default value:</translate>' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+' (1.39+)

" %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+" (1.8-1.38)

" %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF" (1.6-1.7)

详情

File:OOjs UI icon notice-destructive.svg <translate> Warning:</translate> 除非您知道在做什么,否则请不要更改此设置!

This is a regex character class (i.e. a list of characters in a format suitable for a regular expression) that you want MediaWiki to allow in page titles despite being in the list of illegal characters.

The list of illegal characters is as follows: #<>[]|{}, non-printable characters 0 through 31, and 'delete' character 127.

存在问题的字符

如果启用了以下标点符号可能会导致问题:

  • []{}|# - 这些是链接和模板语法所必需的,切勿启用它们。
  • <> - 这些会导致HTML转义问题,请不要使用。
  • % - 请求的重写规则(rewrite)的路径存在一些小问题,请参见下文。包含在默认的允许列表中。
  • + - 在apache中请求的重写规则的路径无法正常运行。 自MediaWiki 1.8.0版本开始被包含于默认的允许列表中。 在极少数情况下,您可能希望删除+以与旧链接兼容。
  • ? - 对于PATH_INFO重写的路径无法正常运行。被包含于默认的允许列表中。

最后三个标点问题可以通过使用别名(alias)而不是重写(rewrite)规则来避免。

The problem with % is that when using a path to query rewrite rule, URLs are double-unescaped: once by Apache's path conversion code, and again by PHP. So %253F, for example, becomes "?". Our code does not double-escape to compensate for this, indeed double escaping would break if the double-escaped title was passed in the query string rather than the path. This is a minor security issue because articles can be created such that they are hard to view or edit.

Theoretically 0x80-0x9F of ISO 8859-1 should be disallowed, but this breaks interlanguage links and so they are included in the allowed list by default.

参考资料

参见