[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1381766 - /subversion/trunk/subversion/libsvn_subr/utf_validate.c

From: Peter Samuelson <peter_at_p12n.org>
Date: Fri, 7 Sep 2012 12:19:15 -0500

[stefan2_at_apache.org]
> + for (; len > 0; ++data, --len)
> + if (*data < 0)
> + return data;

Two major problems:

1) It doesn't account for character sets like Shift-JIS, where state
   change is signalled by ASCII 14 and 15 ("shift out", "shift in")

2) It assumes a 'char' is signed by default. This is not true on all
   platforms.

Better to test if (*data < 32 || *data > 127), even though that has
false positives with characters like \t and \n.

Peter
Received on 2012-09-07 19:20:19 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.