Accept '@' in locale names.

2006-12-18  Matthias Clasen  <mclasen@redhat.com>

        * glib/gkeyfile.c: Accept '@' in locale names.
This commit is contained in:
Matthias Clasen 2006-12-18 14:13:34 +00:00 committed by Matthias Clasen
parent 6b52690bb5
commit 52ef9438ca
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
2006-12-18 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c: Accept '@' in locale names.
* glib/gkeyfile.c: Tighten up the check for allowed
key and group names. (#343191, Tommi Komulainen)

View File

@ -3240,7 +3240,7 @@ g_key_file_is_key_name (const gchar *name)
if (*q == '[')
{
q++;
while (*q && (g_unichar_isalnum (g_utf8_get_char (q)) || *q == '-' || *q == '_' || *q == '.'))
while (*q && (g_unichar_isalnum (g_utf8_get_char (q)) || *q == '-' || *q == '_' || *q == '.' || *q == '@'))
q = g_utf8_next_char (q);
if (*q != ']')

View File

@ -755,7 +755,8 @@ test_locale_string (void)
"key1[de_DE]=v1-de_DE\n"
"key1[de_DE.UTF8]=v1-de_DE.UTF8\n"
"key1[fr]=v1-fr\n"
"key1[en] =v1-en\n";
"key1[en] =v1-en\n"
"key1[sr@Latn]=v1-sr\n";
keyfile = load_data (data, G_KEY_FILE_KEEP_TRANSLATIONS);
@ -766,6 +767,7 @@ test_locale_string (void)
check_locale_string_value (keyfile, "valid", "key1", "fr", "v1-fr");
check_locale_string_value (keyfile, "valid", "key1", "fr_FR", "v1-fr");
check_locale_string_value (keyfile, "valid", "key1", "en", "v1-en");
check_locale_string_value (keyfile, "valid", "key1", "sr@Latn", "v1-sr");
g_key_file_free (keyfile);