On Tue, Nov 06, 2007 at 04:05:13PM +0200, Ahmed S. Darwish wrote:
> On Tue, Nov 06, 2007 at 02:34:46PM +0100, Adrian Bunk wrote:
> > On Tue, Nov 06, 2007 at 07:49:26AM -0500, Kyle Moffett wrote:
> > > On Nov 06, 2007, at 07:23:36, Ahmed S. Darwish wrote:
> > >> On 11/6/07, Adrian Bunk <[email protected]> wrote:
> > >>> On Tue, Nov 06, 2007 at 01:34:05PM +0200, Ahmed S. Darwish wrote:
> > >>>> As far as I understand the problem now, isspace() accepts the 0xa0
> > >>>> character which might collide with some of UTF-8 encoded characters
> > >>>> cause the high bit is set.
> > >>
> > >> I admit I'm not experienced in such encoding stuff, but shouldn't the
> > >> ASCII and the ASCII-compatible UTF-8 encodings be enough for the labels?
> > >>
> > >>> It would not work if someone would e.g. give you UTF-16 encoded strings,
> > >>> but I don't see this happening in practice.
> > >>
> > >> Won't this complicate the code too much ?
> > >
> > > Well the VFS (for example) certainly doesn't support any encodings other
> > > than various extended-ASCII forms (which includes UTF-8). Something like
> > > UTF-16 has extra null characters in-between every normal character, and as
> > > such would fail completely if passed to the VFS.
> >
> > Good point.
> >
> > > Personally I think that isspace() accepting character 0xA0 is a bug, as
> > > there are several variants of extended ASCII only one of which has that
> > > character as a space. Others have it as ?? (accented A), etc.
> >
> > But even then Smack would still have a similar problem with isgraph().
> >
>
> Great, To summarize the discussion. Will there be a problem in
> accepting ASCII and the UTF-8 ASCII _subset_ _only_ and return
> -EINVAL for all other cases/ecnodings ?.
The UTF-8 ASCII subset is the complete ASCII.
> i.e. The fragment I sent in a previous message:
>
> /* Filter UTF-8 non-ascii compatible bytes (> 0x7F) */
> if (!isascii(c)) return -EINVAL;
> /* Filter unwanted ascii chars */
> if (!isspace(c) && !isgraph(c)) return -EINVAL;
>...
As I already said, this should work fine.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]