[Haskell-cafe] bug in Prelude.words?

James Cook mokus at deepbondi.net
Mon Mar 28 18:24:10 CEST 2011


On Mar 28, 2011, at 12:05 PM, Christopher Done wrote:

> On 28 March 2011 17:55, malcolm.wallace <malcolm.wallace at me.com>  
> wrote:
> Does anyone else think it odd that Prelude.words will break a string  
> at a non-breaking space?
>
> Prelude> words "abc def\xA0ghi"
> ["abc","def","ghi"]
>
> I think it's predictable, isSpace (which words is based on) is based  
> on generalCategory, which returns the proper Unicode category:
>
> λ> generalCategory '\xa0'
> Space

I agree, and I also agree that it would make sense the other way (not  
breaking on non-breaking spaces).  Perhaps it would be a good idea to  
add a remark to the documentation which specifies the treatment of non- 
breaking spaces.

-- James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110328/e09ae846/attachment.htm>


More information about the Haskell-Cafe mailing list