]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Escape localized strings in PPDs.
authorMichael R Sweet <msweet@msweet.org>
Mon, 23 Sep 2024 13:17:42 +0000 (09:17 -0400)
committerMichael R Sweet <msweet@msweet.org>
Mon, 23 Sep 2024 13:17:48 +0000 (09:17 -0400)
cups/ppd-cache.c

index 2662738eb23fa5ac19167ea2df888e02013e5b27..90784aa7bc6d668ae85c6c15d497417cd4aa0246 100644 (file)
@@ -5611,7 +5611,21 @@ ppd_put_strings(cups_file_t *fp, /* I - PPD file */
   for (lang = langs; lang; lang = lang->next)
   {
     if (strcmp(lang->language, "en") && (text = _cupsLangString(lang, pwg_msgid)) != pwg_msgid)
-      cupsFilePrintf(fp, "*%s.%s %s/%s: \"\"\n", lang->language, ppd_option, ppd_choice, text);
+    {
+      // Add the first line of localized text...
+      cupsFilePrintf(fp, "*%s.%s %s/", lang->language, ppd_option, ppd_choice);
+      while (*text && *text != '\n')
+      {
+        // Escape ":" and "<"...
+        if (*text == ':' || *text == '<')
+          cupsFilePrintf(fp, "<%02X>", *text);
+        else
+          cupsFilePutChar(fp, *text);
+
+        text ++;
+      }
+      cupsFilePuts(fp, ": \"\"\n");
+    }
   }
 }