
On Sat, 2007-06-30 at 18:46 -0400, MenTaLguY wrote:
But please do not try to improve it unless you are willing to dig out all the now-closed bugreports and retest them again after your changes.
Can you give me a list? We absolutely do have to fix this.
Along those lines, here's the change I committed. The quoting of font names with international characters isn't altered by this change, so we need only reexamine those bugs which involved fully US-ASCII font names.
Glib::ustring t; bool quote = false; + bool last_was_space = false;
for (gchar const *i = val; *i; i++) { + bool is_space = ( *i == ' ' ); if (g_ascii_isalnum(*i) || *i=='-' || *i=='_') { + // ASCII alphanumeric, - and _ don't require quotes t.push_back(*i); + } else if ( is_space && !last_was_space ) { + // non-consecutive spaces don't require quotes + t.push_back(*i); } else if (*i==''') { + // single quotes require escaping and quotes t.push_back('\'); t.push_back(*i); quote = true; } else { + // everything else requires quotes t.push_back(*i); quote = true; } if (i == val && !g_ascii_isalpha(*i)) { + // a non-ASCII/non-alpha initial character requires quotes quote = true; } + last_was_space = is_space; } + + if (last_was_space) { + // a trailing space requires quotes + quote = true; + }
-mental