Make better Unicode-compliant and unify some UTF-8 code pathes.

* grub-core/normal/charset.c (grub_utf8_to_utf16): Don't eat possibly
	valid character.
	(grub_is_valid_utf8): Use grub_utf8_process.
	Check resulting code range.
	(grub_utf8_to_ucs4): Use grub_utf8_process.
	* include/grub/charset.h (grub_utf16_to_utf8): Don't eat up a possibly
	valid character.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-25 15:57:50 +01:00
parent cc4fddf5f5
commit 8569f13d8d
3 changed files with 45 additions and 97 deletions

View file

@ -76,6 +76,8 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, const grub_uint16_t *src,
{
/* Error... */
*dest++ = '?';
/* *src may be valid. Don't eat it. */
src--;
}
code_high = 0;