does g_utf8_collate() need check whether its parameter is utf8 or not?
- From: "yandong.yao" <Yandong Yao Sun COM>
- To: gtk-list gnome org
- Subject: does g_utf8_collate() need check whether its parameter is utf8 or not?
- Date: Thu, 29 Jun 2006 14:55:08 +0800
Hi guys,
If i ask in wrong alias, please forgive me and forward to correct alias,
thank you.
The document of g_utf8_collate() require its parameters should be utf-8
encoded, but
it did not check this in function body, so g_utf8_normalize() may return
NULL for
non-utf8 string, thus strcoll() will crash. I have met such problem for
several time
on opensolaris.
So we need check at somewhere, 3 candidate:
1) check parameter in strcoll(): but because different c lib has diff
implementation,
so i guess it is not a good place to avoid this problem.
2) check parameter in g_utf8_* function: check parameter in this level
will sensible,
but it will result in a few check statement in g_utf8_* functions.
3) check in caller of g_utf8_*, this is ok also, but need every
developer to do this.
i prefer 2), cause it will reduce lots of developer's work, and the cost
is little also.
any comments or suggestions are welcome, thank you in advance.
regards,
yandong
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]