[recipes] Fix recipe-extract tool for non-ASCII



commit 421f184811bf4a15b64f82389d139c21022f2560
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 3 14:58:11 2017 -0500

    Fix recipe-extract tool for non-ASCII
    
    This was written too quickly, and did not take UTF-8 into
    account.

 tools/recipe-extract.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/tools/recipe-extract.c b/tools/recipe-extract.c
index 9389a2a..8ac2dbf 100644
--- a/tools/recipe-extract.c
+++ b/tools/recipe-extract.c
@@ -34,10 +34,11 @@ emit_string (const char *s)
         int i;
 
         s2 = g_string_new ("");
-        for (p = s; *p; p++) {
-                if (*p == '"' || *p == '\\')
+        for (p = s; *p; p = g_utf8_next_char (p)) {
+                gunichar ch = g_utf8_get_char (p);
+                if (ch == (gunichar)'"' || ch == (gunichar)'\\')
                         g_string_append_c (s2, '\\');
-                g_string_append_c (s2, *p);
+                g_string_append_unichar (s2, ch);
         }
 
         strv = g_strsplit (s2->str, "\n", -1);


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