Re: Escaping in (#51382)



Tim Janik <timj gtk org> writes:

> On 17 Mar 2001, Owen Taylor wrote:
> 
> > 
> > Tim Janik <timj gtk org> writes:
> > 
> > > > > >  * GScanner and hence RC files support C-string like
> > > > > >    escaping with \n \r \t \b \f and octal escapes.
> > > > > > 
> > > > > >    This would imply:
> > > > > > 
> > > > > >    "/_File/\\/var\\/log\\/messages"
> > > > > 
> > > > > we don't actually have an option here, the item factory
> > > > > dumps are supposed to be GScanner parsable, so we'll have
> > > > > to use this style.
> > > > 
> > > > OK, I'll do that then.
> > > 
> > > that's not much, i.e. it shouldn't be more than just:
> >  
> > > + name = g_strescape (string, NULL);
> > > + g_free (string);
> > > + string = name;
> > >   data->print_func (data->func_data, string);
> > 
> > Well, considering that g_strescape() mangles UTF-8 pretty
> > badly, I just wrote my own escaper in a few lines.
> 
> urg, i'm using that in a couple other places as well, what's the
> problem here?

Well, I'm not sure mangle is quite the right term, but the fact that
g_strescape is paranoid and escapes all high bit bytes means that a
UTF-8 string coming in comes out as something illegable with multiple
octal escapes per character.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]