Last modified: 2014-10-24 01:12:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20469, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18469 - Don't add &nbsp; in <pre>
Don't add &nbsp; in <pre>
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-15 02:12 UTC by Toshio Kuratomi
Modified: 2014-10-24 01:12 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Toshio Kuratomi 2009-04-15 02:12:36 UTC
We had a user cut and paste a template from our mediawiki installation end up with some strange non-space invisible characters today.  We think the cut and paste is a bit obscure.  (He's using vimperator on firefox and that seems to have been part of how this happens).  However, looking at what caused the special characters we found that mediawiki is adding &nbsp; if it's preceded with certain special characters.  This happens even if the text occurs in a <pre> tag which seem redundant in most cases and, in this case, leads to the cut and paste bug we observed.

The following code seems to be causing this:

from Parser::parse():

# Clean up special characters, only run once, next-to-last before doBlockLevels
$fixtags = array(
        # french spaces, last one Guillemet-left
        # only if there is something before the space
        '/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&nbsp;\\2',
        # french spaces, Guillemet-right
        '/(\\302\\253) /' => '\\1&nbsp;',
        '/&nbsp;(!\s*important)/' => ' \\1', #Beware of CSS magic word
!important, bug #11874.
);

It would be great if this code was smart enough to not replace spaces with &nbsp; inside of a <pre>.
Comment 1 Andre Klapper 2014-10-24 01:12:00 UTC
Wondering if this is still a problem.
This code is in includes/parser/Parser.php and is slightly different nowadays:

(In reply to Toshio Kuratomi from comment #0)
>         '/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&nbsp;\\2',

Now:      '/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&#160;',

>         '/(\\302\\253) /' => '\\1&nbsp;',

Now:      '/(\\302\\253) /' => '\\1&#160;',

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links