Indeed, that's what JDK's javadoc seems to be saying.
The only change in jdk 1.5 was methods that take int as an argument instead of char. Reading the documentation of isWhitespace I realized that it DOES include all unicode space characters! And in addition to that it includes the standard ASCII whitespace characters because they are not included in the unicode
space characters.

But for some unknown reason it explicitly decides to excude non-breaking space from whitespace characters.
And for that I have not been able to find any reason.

Maybe they think that there is a consensus on not considering non-breaking space as whitespace? But it does not seem so widespread because unicode thinks about it differently...

I would add the non-breaking space to H2's whitespace, because if it looks like whitespace it should be whitespace ... right?

- rami

On 25.6.2011 23:44, cowwoc wrote:

FYI: Character.isSpaceChar(char) has been around since the time isWhitespace(char) was added. The only thing that's new is the isSpaceChar(int) method.

Gili

On 25/06/2011 1:03 PM, Rami Ojares wrote:
It turns out that isWhitespace(..) is a legacy method and does not consider nbsp as a whitespace character
(which it most certainly is according to unicode standard).
In Java 1.5 a new method was defined in the character class isSpaceChar(..)
that properly recognizes all unicode space characters.
And isWhitespace was left as is for backward compatibility.

See for example:
http://stackoverflow.com/questions/1060570/why-is-non-breaking-space-not-a-whitespace-character-in-java

- rami

On 25.6.2011 18:54, Thomas Mueller wrote:
Hi,

What is the exact Unicode character code? The parser uses:

if (c<= ' ' || Character.isWhitespace(c)) {
   // whitespace
}

Character.isWhitespace is supposed to return true for a non-breaking space.

Regards,
Thomas




--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to