summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-127
-rw-r--r--ChangeLog.pre-2-27
-rw-r--r--ChangeLog.pre-2-47
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--glib/gmessages.c49
8 files changed, 84 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 34947a7ef..e98ae1156 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+Thu Mar 28 20:31:51 2002 Tim Janik <timj@gtk.org>
+
+ * glib/gmessages.c:
+ (g_print):
+ (g_printerr): convert prtinf() strings to local charset
+ when writing them to stdout or stderr.
+
Wed Mar 27 18:42:22 2002 Tim Janik <timj@gtk.org>
* gmessages.[hc]:
diff --git a/glib/gmessages.c b/glib/gmessages.c
index 40e638993..4a72be50a 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -527,6 +527,16 @@ g_log (const gchar *log_domain,
va_end (args);
}
+static gchar*
+strdup_convert (const gchar *string,
+ const gchar *charset)
+{
+ if (!g_utf8_validate (string, -1, NULL))
+ return g_strconcat ("[Invalid UTF-8] ", string, NULL);
+ else
+ return g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, NULL);
+}
+
/* For a radix of 8 we need at most 3 output bytes for 1 input
* byte. Additionally we might need up to 2 output bytes for the
* readix prefix and 1 byte for the trailing NULL.
@@ -760,18 +770,9 @@ g_log_default_handler (const gchar *log_domain,
g_string_append (gstring, message); /* charset is UTF-8 already */
else
{
- if (!g_utf8_validate (message, -1, NULL))
- {
- g_string_append (gstring, "[Invalid UTF-8] ");
- g_string_append (gstring, message);
- }
- else
- {
- string = g_convert_with_fallback (message, -1, charset, "UTF-8",
- ".", NULL, NULL, NULL);
- g_string_append (gstring, string);
- g_free (string);
- }
+ string = strdup_convert (message, charset);
+ g_string_append (gstring, string);
+ g_free (string);
}
}
if (is_fatal)
@@ -820,8 +821,18 @@ g_print (const gchar *format,
local_glib_print_func (string);
else
{
+ const gchar *charset;
+
ensure_stdout_valid ();
- fputs (string, stdout);
+ if (g_get_charset (&charset))
+ fputs (string, stdout); /* charset is UTF-8 already */
+ else
+ {
+ gchar *lstring = strdup_convert (string, charset);
+
+ fputs (lstring, stdout);
+ g_free (lstring);
+ }
fflush (stdout);
}
g_free (string);
@@ -862,7 +873,17 @@ g_printerr (const gchar *format,
local_glib_printerr_func (string);
else
{
- fputs (string, stderr);
+ const gchar *charset;
+
+ if (g_get_charset (&charset))
+ fputs (string, stderr); /* charset is UTF-8 already */
+ else
+ {
+ gchar *lstring = strdup_convert (string, charset);
+
+ fputs (lstring, stderr);
+ g_free (lstring);
+ }
fflush (stderr);
}
g_free (string);