Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -151,16 +151,31 @@ |
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
155 | | - * We want / and : to be included as literal characters in our title URLs. |
| 155 | + * We want some things to be included as literal characters in our title URLs |
| 156 | + * for prettiness, which urlencode encodes by default. According to RFC 1738, |
| 157 | + * all of the following should be safe: |
| 158 | + * |
| 159 | + * ;:@&=$-_.+!*'(), |
| 160 | + * |
| 161 | + * But + is not safe because it's used to indicate a space; &= are only safe in |
| 162 | + * paths and not in queries (and we don't distinguish here); ' seems kind of |
| 163 | + * scary; and urlencode() doesn't touch -_. to begin with. Plus, although / |
| 164 | + * is reserved, we don't care. So the list we unescape is: |
| 165 | + * |
| 166 | + * ;:@$!*(),/ |
| 167 | + * |
156 | 168 | * %2F in the page titles seems to fatally break for some reason. |
157 | 169 | * |
158 | 170 | * @param $s String: |
159 | 171 | * @return string |
160 | 172 | */ |
161 | | -function wfUrlencode ( $s ) { |
| 173 | +function wfUrlencode( $s ) { |
162 | 174 | $s = urlencode( $s ); |
163 | | - $s = preg_replace( '/%3[Aa]/', ':', $s ); |
164 | | - $s = preg_replace( '/%2[Ff]/', '/', $s ); |
| 175 | + $s = str_ireplace( |
| 176 | + array( '%3B','%3A','%40','%24','%21','%2A','%28','%29','%2C','%2F' ), |
| 177 | + array( ';', ':', '@', '$', '!', '*', '(', ')', ',', '/' ), |
| 178 | + $s |
| 179 | + ); |
165 | 180 | |
166 | 181 | return $s; |
167 | 182 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -57,6 +57,7 @@ |
58 | 58 | being converted or not |
59 | 59 | * (bug 14921) Special:Contributions/: add user name to <title> |
60 | 60 | Patch by Emufarmers |
| 61 | +* Unescape more "safe" characters when producing URLs, for added prettiness |
61 | 62 | |
62 | 63 | === Bug fixes in 1.14 === |
63 | 64 | |