Add functions to insert a unichar as UTF-8, since this is reasonably

Fri Jul 13 19:20:06 2001  Owen Taylor  <otaylor@redhat.com>

	* glib/gstring.c (g_string_insert/append/prepend_unichar):
	Add functions to insert a unichar as UTF-8, since this
	is reasonably common.

	* glib/gutf8.c glib/gunicode.h (g_utf8_get_char_validated):
	New function exposing iterating through possibly invalid/incomplete
	UTF-8 to unicode to the outside world.

	* glib/gutf8.c (g_utf8_get_char_extended): Fix max_len argument
	to be gssize, not gsize.
This commit is contained in:
Owen Taylor
2001-07-19 14:35:48 +00:00
committed by Owen Taylor
parent 926af68d34
commit f37c13dbde
14 changed files with 220 additions and 12 deletions

View File

@@ -11,8 +11,6 @@ decode (const gchar *input)
unsigned ch;
int offset = 0;
GString *result = g_string_new (NULL);
int len;
char buf[6];
do
{
@@ -30,8 +28,7 @@ decode (const gchar *input)
return NULL;
}
len = g_unichar_to_utf8 (ch, buf);
g_string_append_len (result, buf, len);
g_string_append_unichar (result, ch);
while (input[offset] && input[offset] != ' ')
offset++;