computerline1z / okapi

Automatically exported from code.google.com/p/okapi
0 stars 0 forks source link

Checker : different leading/trailing spaces does not detect inconsistent non-breaking spaces #257

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The summary says it all.
(Windows, m17)

== Explanation:
The current detection uses Character.isWhitespace
That method does not consider nbsp as whitespace (javadoc, also tested).

== Proposed fix:
I have tried isSpace, isSpaceChar, and isWhitespace for all char between 0 and 
FFFF.
isSpaceChar is the only one returning true for nbsp.

Change the test to do isWhitespace | isSpaceChar
The only characters that will give different results are:
  0x00A0  NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020
  0x2007  FIGURE SPACE;Zs;0;WS;<noBreak> 0020
  0x202F  NARROW NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020

I think it is safe to change.

== I will fix it if you "Accept" it

Original issue reported on code.google.com by mihn...@gmail.com on 25 Jul 2012 at 11:53

GoogleCodeExporter commented 9 years ago
From the traditional definition of 'white-space' nbsp is not included.
But you are right: I don't see a reason to exclude 'space chars' in this check.
I'd say +1.

Original comment by yves.sav...@gmail.com on 26 Jul 2012 at 3:37

GoogleCodeExporter commented 9 years ago
Fixed in "checker" branch.

Original comment by mihn...@gmail.com on 30 Jul 2012 at 5:07