My understanding is that in Ruby, all the pre-Unicode escapes, and in 
particular "\s", still refer only to characters in the ASCII range.

My understanding is that this was done in this way for backwards 
compatibility, and on purpose. This can be explained as follows: Maybe 
somebody wrote a script doing some processing where they wanted to match 
ASCII 'space' characters. They used \s. If Ruby would change \s to 
suddenly match way more than before, the meaning of that program would 
change. Maybe it would change just in the right way. But maybe it would 
change in an unintended way.

So the decision was to not second-guess the programmer. As a result, 
this does not behave the same way as what's suggested in Unicode TR #18. 
But please note that UTR #18 doesn't *require* \s to be treated as 
Unicode whitespace, it just *recommends* to do so (see 
http://www.unicode.org/reports/tr18/#Compatibility_Properties).

If you want to match against Unicode whitespace, what you should do is 
the following:

"\u00a0" =~ /\p{Whitespace}/u

Regards,    Martin.

On 2012/10/14 8:37, t0d0r (Todor Dragnev) wrote:
>
> Issue #7154 has been reported by t0d0r (Todor Dragnev).
>
> ----------------------------------------
> Bug #7154: For whatever reason \s doesn't match \u00a0.
> https://bugs.ruby-lang.org/issues/7154
>
> Author: t0d0r (Todor Dragnev)
> Status: Open
> Priority: Normal
> Assignee:
> Category: core
> Target version:
> ruby -v: 1.9.3p286
>
>
> The problem is already explained here:
>
> http://stackoverflow.com/questions/2588942/convert-non-breaking-spaces-to-spaces-in-ruby
>
> I just hit it today.
>
>