Re: Glib::Regex and unicode chars



On Sun, 2012-08-19 at 19:10 +0200, Jakub Okoński wrote:
> Hello,
> 
> 
> I'm trying to implement syntax highlighting and it works perfectly
> until I input some special chars, in which fetch_pos method gives me
> number of bytes rather than characters.

Yes, that's what its documented as doing:
http://developer.gnome.org/glibmm/unstable/classGlib_1_1MatchInfo.html#a59b2852b02e4c8a6300790793611ee44
http://developer.gnome.org/glib/unstable/glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-pos

I guess that is more helpful when you want to get a substring of a C
string or a std::string and we didn't think about it when wrapping it
for gtkmm. Maybe we should add a fetch_pos_chars() to be more suitable
for use with Glib::ustring::operator[], though it would probably be most
efficient if that was in GTK+ itself.

And there is already this method, though I guess it's not so efficient:
Glib::ustring fetch(const Glib::ustring& name);

 

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



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