Mercurial > dwindows
diff os2/dw.c @ 1784:86ace55df07b
Added UTF8/Wide conversion functions on OS/2 and Windows...
Updated the readme file and some comment cleanups.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 24 Jul 2012 23:33:50 +0000 |
parents | a532ca0231ad |
children | a640714f9087 |
line wrap: on
line diff
--- a/os2/dw.c Tue Jul 24 22:52:57 2012 +0000 +++ b/os2/dw.c Tue Jul 24 23:33:50 2012 +0000 @@ -13279,3 +13279,37 @@ if(day) *day = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_day")) + 1; } + +/* + * Converts a UTF-8 encoded string into a wide string. + * Parameters: + * utf8string: UTF-8 encoded source string. + * Returns: + * Wide string that needs to be freed with dw_free() + * or NULL on failure. + */ +wchar_t * API dw_utf8_to_wchar(char *utf8string) +{ +#ifdef UNICODE + return _UTF8toWide(utf8string); +#else + return NULL; +#endif +} + +/* + * Converts a wide string into a UTF-8 encoded string. + * Parameters: + * wstring: Wide source string. + * Returns: + * UTF-8 encoded string that needs to be freed with dw_free() + * or NULL on failure. + */ +char * API dw_wchar_to_utf8(wchar_t *wstring) +{ +#ifdef UNICODE + return _WideToUTF8(wstring); +#else + return NULL; +#endif +}