diff --git a/ChangeLog b/ChangeLog index 10165c052..5906d1aba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 10165c052..5906d1aba 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2000-12-17 Tor Lillqvist + + * gutf8.c (g_utf8_get_charset_internal): (Win32) Use GetACP to get + the current ANSI codepage. + + * gunicode.h: Add comment that the static string g_get_charset + sets the parameter to point to should be copied in case the + charset might be changed later in the program. + 2000-12-14 Tor Lillqvist * makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when diff --git a/glib/gunicode.h b/glib/gunicode.h index 6810a2106..93f368337 100644 --- a/glib/gunicode.h +++ b/glib/gunicode.h @@ -105,7 +105,9 @@ typedef enum /* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is * not null, sets *CHARSET to the name of the current locale's - * charset. This value is statically allocated. + * charset. This value is statically allocated, and should be copied + * in case the locale's charset will be changed later using setlocale() + * or in some other way. */ gboolean g_get_charset (char **charset); diff --git a/glib/gutf8.c b/glib/gutf8.c index f79ab48e3..f584080bc 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -29,6 +29,10 @@ #include "glib.h" +#ifdef G_OS_WIN32 +#include +#endif + #define UTF8_COMPUTE(Char, Mask, Len) \ if (Char < 128) \ { \ @@ -318,8 +322,21 @@ g_utf8_get_charset_internal (char **a) } #endif +#ifdef G_OS_WIN32 + if (a && ! *a) + { + static char codepage[10]; + + sprintf (codepage, "CP%d", GetACP ()); + *a = codepage; + /* What about codepage 1200? Is that UTF-8? */ + return FALSE; + } +#else if (a && ! *a) *a = "US-ASCII"; +#endif + /* Assume this for compatibility at present. */ return FALSE; } diff --git a/gobject/gobject.def b/gobject/gobject.def index 453a401e1..a2f3bdff5 100644 --- a/gobject/gobject.def +++ b/gobject/gobject.def @@ -86,7 +86,6 @@ EXPORTS g_param_value_set_default g_param_value_validate g_param_values_cmp - g_signal_add_emission_hook_full g_signal_connect_closure g_signal_connect_closure_by_id g_signal_connect_data @@ -112,7 +111,6 @@ EXPORTS g_signal_new_valist g_signal_parse_name g_signal_query - g_signal_remove_emission_hook g_signal_stop_emission g_signal_type_cclosure_new g_type_add_class_cache_func diff --git a/gunicode.h b/gunicode.h index 6810a2106..93f368337 100644 --- a/gunicode.h +++ b/gunicode.h @@ -105,7 +105,9 @@ typedef enum /* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is * not null, sets *CHARSET to the name of the current locale's - * charset. This value is statically allocated. + * charset. This value is statically allocated, and should be copied + * in case the locale's charset will be changed later using setlocale() + * or in some other way. */ gboolean g_get_charset (char **charset); diff --git a/gutf8.c b/gutf8.c index f79ab48e3..f584080bc 100644 --- a/gutf8.c +++ b/gutf8.c @@ -29,6 +29,10 @@ #include "glib.h" +#ifdef G_OS_WIN32 +#include +#endif + #define UTF8_COMPUTE(Char, Mask, Len) \ if (Char < 128) \ { \ @@ -318,8 +322,21 @@ g_utf8_get_charset_internal (char **a) } #endif +#ifdef G_OS_WIN32 + if (a && ! *a) + { + static char codepage[10]; + + sprintf (codepage, "CP%d", GetACP ()); + *a = codepage; + /* What about codepage 1200? Is that UTF-8? */ + return FALSE; + } +#else if (a && ! *a) *a = "US-ASCII"; +#endif + /* Assume this for compatibility at present. */ return FALSE; }