]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix last msgexec.c commit. Add comments.
authorBruno Haible <bruno@clisp.org>
Thu, 13 Aug 2009 20:15:35 +0000 (22:15 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 13 Aug 2009 20:15:35 +0000 (22:15 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/msgexec.c
gettext-tools/src/msgfilter.c

index 389f5ffcbf4bc446249fb1a8db9c6bb47ae7b158..debde4daedac04a7d48233310e440fbb38a9f47f 100644 (file)
@@ -2,6 +2,8 @@
 
        * msgexec.c: Include msgl-charset.h.
        (main): Invoke compare_po_locale_charsets.
+       (process_string): Add comment.
+       * msgfilter.c (process_message): Likewise.
 
 2009-08-10  Bruno Haible  <bruno@clisp.org>
 
index 834190b402475f3b85172666b11896ea1ede397d..f61130d4d5ccf2c81f9fe78bcd676d9110c0314d 100644 (file)
@@ -210,11 +210,11 @@ There is NO WARRANTY, to the extent permitted by law.\n\
   /* Read input file.  */
   result = read_catalog_file (input_file, input_syntax);
 
-  /* Warn if the current locale is not suitable for this PO file.  */
-  compare_po_locale_charsets (result);
-
   if (strcmp (sub_name, "0") != 0)
     {
+      /* Warn if the current locale is not suitable for this PO file.  */
+      compare_po_locale_charsets (result);
+
       /* Block SIGPIPE for this process and for the subprocesses.
         The subprogram may have side effects (additionally to producing some
         output), therefore if there are no readers on stdout, processing of the
@@ -353,7 +353,18 @@ process_string (const message_ty *mp, const char *str, size_t len)
       void (*orig_sigpipe_handler)(int);
       int exitstatus;
 
-      /* Set environment variables for the subprocess.  */
+      /* Set environment variables for the subprocess.
+        Note: These environment variables, especially MSGEXEC_MSGCTXT and
+        MSGEXEC_MSGCTXT, may contain non-ASCII characters.  The subprocess
+        may not interpret these values correctly if the locale encoding is
+        different from the PO file's encoding.  We want about this situation,
+        above.
+        On Unix, this problem is often harmless.  On Windows, however, - both
+        native Windows and Cygwin - the values of environment variables *must*
+        be in the encoding that is the value of GetACP(), because the system
+        may convert the environment from char** to wchar_t** before spawning
+        the subprocess and back from wchar_t** to char** in the subprocess,
+        and it does so using the GetACP() codepage.  */
       if (mp->msgctxt != NULL)
        xsetenv ("MSGEXEC_MSGCTXT", mp->msgctxt, 1);
       else
index 3fe7525e22a8cc49f79c09e92efc3faa6f39d8e9..4cb2642ae15ffbd04ce310622ec350d7ca16e6ed 100644 (file)
@@ -609,7 +609,18 @@ process_message (message_ty *mp)
   if (is_header (mp) && keep_header)
     return;
 
-  /* Set environment variables for the subprocess.  */
+  /* Set environment variables for the subprocess.
+     Note: These environment variables, especially MSGEXEC_MSGCTXT and
+     MSGEXEC_MSGCTXT, may contain non-ASCII characters.  The subprocess
+     may not interpret these values correctly if the locale encoding is
+     different from the PO file's encoding.  We want about this situation,
+     above.
+     On Unix, this problem is often harmless.  On Windows, however, - both
+     native Windows and Cygwin - the values of environment variables *must*
+     be in the encoding that is the value of GetACP(), because the system
+     may convert the environment from char** to wchar_t** before spawning
+     the subprocess and back from wchar_t** to char** in the subprocess,
+     and it does so using the GetACP() codepage.  */
   if (mp->msgctxt != NULL)
     xsetenv ("MSGFILTER_MSGCTXT", mp->msgctxt, 1);
   else