Is non-breaking space a space?

Erik Trulsson ertr1013 at student.uu.se
Mon Dec 1 21:29:09 PST 2003


On Tue, Dec 02, 2003 at 01:31:07AM +0100, Jean-Baptiste Quenot wrote:
> Hello,
> 
> I'm wondering why the non-breaking space is considered as a space in the
> FreeBSD  C library,  whereas  it is  not  in the  GNU  libc.  Sorry  for
> comparing the two,  but as a result, Linux and  FreeBSD are incompatible
> in the way  they handle isspace(160).  This *only*  occurs when LC_CTYPE
> is given « single C chars locales » like en_US.ISO8859-1.

FreeBSD and glibc people have obviously made different decisions about
how the locales should be defined.
For what it is worth, both Solaris and NetBSD agree with FreeBSD on this.


> 
> In  /usr/src/share/mklocale, the  file  la_LN.ISO8859-1.src for  example
> contains a  SPACE definition that  includes the non-breaking  space.  It
> seems that it  is so since the  beginning of FreeBSD, but  is there some
> reference, some standard that states  whether NBSP is considered a space
> or not?

According to the C standard it is implementation-defined (for locales
other than the "C" locale. In the "C" locale NBSP is not considered as
a space.) Both the Linux and FreeBSD definitions are compatible with
the C standard.

If you look at the locale definitions found at
http://www.dkuug.dk/JTC1/SC22/WG15  it would seem that NBSP should be
considered as a space character, but there might be some other standard
somewhere else that says differently.

My belief is that FreeBSD gets it right, and GNU libc is wrong, but I
am sure the GNU people have a different opinion.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list