Uconv functions at libc [PSARC/2007/517 FastTrack timeout 09/12/2007]

Ienup Sung Ienup.Sung at sun.com
Thu Sep 6 15:02:24 PDT 2007


Roland Mainz wrote at 09/06/07 02:37 PM:
> Slightly offtopic: Are there plans to provide similar functions which
> converts unicode strings from/to the current |wchar_t| (sometimes
> applications may need an "easy way" (e.g. utility function) which hides
> all complexity of using |iconv()| to convert the data from UTF-8 to
> UCS-4 to current encoding) ?

Since you're asking this to me, at this point, no, I don't have a plan to
have functions that will convert between wchar_t of various locales in various
encodings and UTF-8/UTF-32. (If one needs such function, it will probably
have to be a locale method and the user-level function will have to be
a stub/wrapper function to the locale method of the current locale, as
an idea.)

BTW, the usual recommended way at this point as you know is using
WC <-> MB <-> UTF-8 <-> UTF-32 if you're using non-UTF-8 locales by using
wctomb()/mbtowc() and iconv(). If you're using UTF-8 locale, then,
you can just do WC <-> MB to convert between UTF-32 and UTF-8 at least
with SunOS/OS since we are all into this together with a guarantee that
all UTF-8/Unicode locales of OS/SunOS will use UTF-32 as wide character and
UTF-8 as file code.

Once this project is integrated, for simple conversions between UTF-8 and
UTF-32, you can also use uconv_u8tou32() or uconv_u32tou8() functions
proposed in this project.


>>        <sys/u8_textprep.h>     Committed               A header file that has
>>                                                        function prototypes
>>                                                        and macros.
> 
> 
> What about renaming the header to <sys/unicode_textprep.h>, e.g. a
> longer, more descriptive name may be better... ?

It's a good suggestion and I thought about that too. Since we already
have <sys/u8_textprep.h> with PSARC/2007/458 as a Committed interface,
I'm hoping to piggyback on the existing header file instead of creating
a new header file or changing the existing header file name.

Ienup



More information about the opensolaris-arc mailing list