UCS-2 in gunicode.h



     Hello,
	I was looking into adding

g_utf8_to_ucs2()     [...and...]
g_ucs2_to_utf8()

	...to gunicode.h and submitting a patch.  I'm writing an app and
I'd like to give the option for 16-bit UCS-2 encoding (in addition to
8-bit ASCII and 32-bit UCS-4 encoding).

	I could see other people needing such functions, perhaps to
inter-operate with external Java programs (or who knows what).

	But it occurs to me: UTF-8 can be used to hold *all* Unicode
characters, including those which require 32 bits of space.  So, what
would happen if a function

g_utf8_to_ucs2()

	ran acrossed a character which required 32 bits?  Would you just
drop that character alltogether?  Treat the 32-bit character as two 16-bit
characters (which would break your character-count code and possibly not
be renderable)?  What is the standard behaviour for apps that take UTF-8,
but only support 16-bit Unicode (i.e., what does Java do?)


Thanks,
Derek Simkowiak
dereks@kd-dev.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]