Page MenuHomePhabricator

Firefox non-breaking spaces bug workaround
Closed, ResolvedPublic

Description

Currently Firefox browsers replace non-breaking spaces with normal spaces when
editing page. There should be a workaround on MediaWiki side: all Unicode U+00A0
spaces in article code should be replaced with another symbol (something like
U+20DE) before sending edit form to browser. When saving code, U+20DE should
become U+00A0.

Such a behavior should be enabled:

  1. for Firefox users by default
  2. for other users who enabled this option in their user settings

Also, that's good to replate   with U+20DE too.


Version: unspecified
Severity: major
URL: https://bugzilla.mozilla.org/show_bug.cgi?id=218277

Details

Reference
bz6790

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:20 PM
bzimport set Reference to bz6790.
bzimport added a subscriber: Unknown Object (MLST).

ayg wrote:

U+20DE is Combining Enclosing Square according to my character map. Surely you
don't want a combining character to stand in for an nbsp? In fact, you probably
don't want any valid Unicode general-use character for that; you'd want a
private-use character from the U+F0.. range, because otherwise this will eat
valid uses of the substituted character.

Arguably nobody should be using raw nbsp's in an input box anyway, since it's
horribly confusing: converting them to entities for everyone would also work.
Is this unacceptable to anyone?

It's not so important which character to select for substitution, but we need to
save Unicode spaces anyway.

The actual reason is that there're many typographical rules in Russian Wikipedia
which require non-breaking spaces; currently we use   but it's too hard to
read article with many  -s present.

ayg wrote:

Fair enough. Of course, Firefox users will have to see all those boxes, which
is as bad for them. It would be interesting to consider ways to automatically
add nbsp's during rendering in certain positions, on a per-language basis;
certainly there are many rules of that sort for English as well, and undoubtedly
other languages, which should be fairly easily to algorithmize.

This is data loss, so I'm setting severity to major.

shattered wrote:

proposed solution

safeUnicodeOutput() clone that only replaces the nbsp character.

Attached:

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Thank you for the patch, shattered, and I'm sorry it's been so long and no one has responded to review your patch. I've added the need-review keyword so developers know that it awaits review.

(In reply to comment #5)

Still a problem with FF3.6

How about FF8?

(In reply to comment #8)

(In reply to comment #5)

Still a problem with FF3.6

How about FF8?

Yay, it's fixed. See http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&oldid=461634004 (nbsp between 17 and km)

Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=218277