Page MenuHomePhabricator

VisualEditor: Edit summary length counter counts characters instead of bytes
Closed, ResolvedPublic

Description

The edit summary length counter (which counts backwards from 255) counts characters, not bytes. However, in languages that heavily rely on unicode charaters, a character is usually more than a byte.

When saving an edit with a summary that is accepted by the counter but with more than 255 bytes, a part of the summary is cut off.

Ceterum censeo bug 4715 esse delendam.


Version: unspecified
Severity: trivial
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=4715

Details

Reference
bz39558

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:03 AM
bzimport set Reference to bz39558.

The db accepts 255 bytes. The php code sets the input maxlength to 250 (instead of 255) to account for some of that overhead, and then a javascript is used to adjust it to the real space.
This is a fixed duplicate, unless it is somehow not working right.

Is that a recent fix? On https://www.mediawiki.org/wiki/VisualEditor:Test it does not work as described by you (though it might be that the live version is out of date).

Oh, I was describing the comment for the normal editor. Yes, the comment counter for the visual editor seems wrong. Sorry.

Should use either $.fn.byteLimit (jquery.byteLimit) or $.byteLength (jquery.byteLenght).

byteLength is for calculating the byte count, byteLimit is an application of that but VE might need its own implementation.

Fixed in I25e93862a39134961bf80835f46cbf531d8109e0.

Though see also bug 40035.