Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » IsSpace() should be true on non breaking space
IsSpace() should be true on non breaking space [message #52797] Thu, 28 November 2019 01:40 Go to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
I think, non breaking space character (0xa0) is space.

Proposed patch (Core/CharSet.h):
-inline bool IsSpace(int c)         { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\v' || c == '\t'; }
+inline bool IsSpace(int c)         { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\v' || c == '\t' || c == 0xa0; }


You can test it with an EditString
someedit.SetFilter(CharFilterNotWhitespace);


And try typing 0160 on numpad while holding down Alt key.
Some users can be tricky.
Re: IsSpace() should be true on non breaking space [message #52802 is a reply to message #52797] Fri, 29 November 2019 09:59 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
zsolt wrote on Thu, 28 November 2019 01:40
I think, non breaking space character (0xa0) is space.

Proposed patch (Core/CharSet.h):
-inline bool IsSpace(int c)         { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\v' || c == '\t'; }
+inline bool IsSpace(int c)         { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\v' || c == '\t' || c == 0xa0; }


You can test it with an EditString
someedit.SetFilter(CharFilterNotWhitespace);


And try typing 0160 on numpad while holding down Alt key.
Some users can be tricky.


I disagree for two reasons:

1) traditional isspace does not treat it as space http://www.cplusplus.com/reference/cctype/isspace/
2) in most text algorithms, hard space is actually treated as non-space - that in fact is its basic purpose...
Previous Topic: [solved] CParser GetColumn bugfix
Next Topic: AMap::Trim(int n)
Goto Forum:
  


Current Time: Fri Mar 29 16:24:49 CET 2024

Total time taken to generate the page: 0.01231 seconds