On Mon, Apr 02, 2007 at 03:26:10PM +0200, Georg Baum wrote:
> [EMAIL PROTECTED] wrote:
> 
> > --- lyx-devel/trunk/src/mathed/InsetMathSymbol.C (original)
> > +++ lyx-devel/trunk/src/mathed/InsetMathSymbol.C Sun Apr  1 15:06:41 2007
> > @@ -20,6 +20,7 @@
> >  #include "LaTeXFeatures.h"
> >  #include "debug.h"
> >  
> > +#include <cctype>
> >  
> >  namespace lyx {
> >  
> > @@ -215,8 +216,13 @@
> >  void InsetMathSymbol::write(WriteStream & os) const
> >  {
> >          os << '\\' << name();
> > -        if (name().size() == 1 && name()[0] < '0') // $,#, etc
> > +
> > +        // $,#, etc. In theory the restriction based on catcodes, but
> > then
> > +        // we do not handle catcodes very well, let alone cat code
> > changes,
> > +        // so being outside the alpha range is good enough.
> > +        if (name().size() == 1 && !std::isalpha(name()[0]))
> >                  return;
> > +
> >          os.pendingSpace(true);
> >  }
> 
> This is wrong: std::isalpha takes a char, and name()[0] is a char_type, so
> it gets truncated, and isalpha may return true for nonalpha characters.
> Apart from that std::isalpha depends on the locale which is not good
> either.
> 
> Surprisingly the same error is in some other places, too.

There was a time when mathed was 7 bit clean...

Andre'

Reply via email to