mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-04 20:59:21 +02:00
Use GetACP to get the current ANSI codepage.
2000-12-17 Tor Lillqvist <tml@iki.fi> * 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.
This commit is contained in:
committed by
Tor Lillqvist
parent
a5f18bb9ba
commit
4f9e04c1d7
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
2000-12-17 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* 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 <tml@iki.fi>
|
2000-12-14 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
* makefile.{mingw,msc}.in: No need to -DGSPAWN_HELPER when
|
||||||
|
@@ -105,7 +105,9 @@ typedef enum
|
|||||||
|
|
||||||
/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is
|
/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is
|
||||||
* not null, sets *CHARSET to the name of the current locale's
|
* 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);
|
gboolean g_get_charset (char **charset);
|
||||||
|
|
||||||
|
17
glib/gutf8.c
17
glib/gutf8.c
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UTF8_COMPUTE(Char, Mask, Len) \
|
#define UTF8_COMPUTE(Char, Mask, Len) \
|
||||||
if (Char < 128) \
|
if (Char < 128) \
|
||||||
{ \
|
{ \
|
||||||
@@ -318,8 +322,21 @@ g_utf8_get_charset_internal (char **a)
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
if (a && ! *a)
|
||||||
*a = "US-ASCII";
|
*a = "US-ASCII";
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Assume this for compatibility at present. */
|
/* Assume this for compatibility at present. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -86,7 +86,6 @@ EXPORTS
|
|||||||
g_param_value_set_default
|
g_param_value_set_default
|
||||||
g_param_value_validate
|
g_param_value_validate
|
||||||
g_param_values_cmp
|
g_param_values_cmp
|
||||||
g_signal_add_emission_hook_full
|
|
||||||
g_signal_connect_closure
|
g_signal_connect_closure
|
||||||
g_signal_connect_closure_by_id
|
g_signal_connect_closure_by_id
|
||||||
g_signal_connect_data
|
g_signal_connect_data
|
||||||
@@ -112,7 +111,6 @@ EXPORTS
|
|||||||
g_signal_new_valist
|
g_signal_new_valist
|
||||||
g_signal_parse_name
|
g_signal_parse_name
|
||||||
g_signal_query
|
g_signal_query
|
||||||
g_signal_remove_emission_hook
|
|
||||||
g_signal_stop_emission
|
g_signal_stop_emission
|
||||||
g_signal_type_cclosure_new
|
g_signal_type_cclosure_new
|
||||||
g_type_add_class_cache_func
|
g_type_add_class_cache_func
|
||||||
|
@@ -105,7 +105,9 @@ typedef enum
|
|||||||
|
|
||||||
/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is
|
/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is
|
||||||
* not null, sets *CHARSET to the name of the current locale's
|
* 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);
|
gboolean g_get_charset (char **charset);
|
||||||
|
|
||||||
|
17
gutf8.c
17
gutf8.c
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UTF8_COMPUTE(Char, Mask, Len) \
|
#define UTF8_COMPUTE(Char, Mask, Len) \
|
||||||
if (Char < 128) \
|
if (Char < 128) \
|
||||||
{ \
|
{ \
|
||||||
@@ -318,8 +322,21 @@ g_utf8_get_charset_internal (char **a)
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
if (a && ! *a)
|
||||||
*a = "US-ASCII";
|
*a = "US-ASCII";
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Assume this for compatibility at present. */
|
/* Assume this for compatibility at present. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user