repo_autopattern: make sure that the category is valid utf8
authorMichael Schroeder <mls@suse.de>
Fri, 13 Dec 2013 13:52:21 +0000 (14:52 +0100)
committerMichael Schroeder <mls@suse.de>
Fri, 13 Dec 2013 13:52:21 +0000 (14:52 +0100)
ext/repo_autopattern.c

index c189cff1e92302d7c336448df85882a80f7c52a4..5a663ba862ce9647b9d8b6a032bba5fa21fd1e7e 100644 (file)
@@ -180,7 +180,14 @@ repo_add_autopattern(Repo *repo, int flags)
              langtag = SOLVABLE_CATEGORY;
              if (*lang && strcmp(lang, "en") != 0)
                langtag = pool_id2langid(pool, SOLVABLE_CATEGORY, lang, 1);
-             repodata_set_str(data, s2 - pool->solvables, langtag, newname);
+             if (newname[solv_validutf8(newname)] == 0)
+               repodata_set_str(data, s2 - pool->solvables, langtag, newname);
+             else
+               {
+                 char *ustr = solv_latin1toutf8(newname);
+                 repodata_set_str(data, s2 - pool->solvables, langtag, ustr);
+                 solv_free(ustr);
+               }
            }
          else if (!strcmp(pn, "pattern-includes()") && evr)
            repodata_add_poolstr_array(data, s2 - pool->solvables, SOLVABLE_INCLUDES, pool_tmpjoin(pool, "pattern:", newname, 0));