aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.h
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2006-03-08 20:55:32 +0000
committerGerald Combs <gerald@wireshark.org>2006-03-08 20:55:32 +0000
commit9406c5db24b03444140ab81fdb13f6a186e1e8a5 (patch)
treeb35df42ea208c1120a98c32020fae4c9b2e751be /epan/strutil.h
parentdef11f9418610a95bccc68e5a31a32bb335099be (diff)
Use Unicode for all native Win32 calls. Unicode Windows applications
use UTF-16 internally and GTK+ 2.x uses UTF-8, which means we have to do a lots of conversions. Add utf_8to16() and utf_16to8 convenience functions to strutil.c. svn path=/trunk/; revision=17534
Diffstat (limited to 'epan/strutil.h')
-rw-r--r--epan/strutil.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/epan/strutil.h b/epan/strutil.h
index 3fbc2437fd..2bd4e59f38 100644
--- a/epan/strutil.h
+++ b/epan/strutil.h
@@ -166,4 +166,26 @@ gsize g_strlcat(gchar *dst, gchar *src, gsize size);
(((c<0x20)||(c>=0x80))?FALSE:TRUE)
#endif
+#ifdef _WIN32
+
+/** Given a UTF-8 string, convert it to UTF-16. This is meant to be used
+ * to convert between GTK+ 2.x (UTF-8) to Windows (UTF-16).
+ *
+ * @param utf8str The string to convert. May be NULL.
+ * @return The string converted to UTF-16. If utf8str is NULL, returns
+ * NULL. The return value should NOT be freed by the caller.
+ */
+wchar_t * utf_8to16(const char *utf8str);
+
+/** Given a UTF-16 string, convert it to UTF-8. This is meant to be used
+ * to convert between GTK+ 2.x (UTF-8) to Windows (UTF-16).
+ *
+ * @param utf16str The string to convert. May be NULL.
+ * @return The string converted to UTF-8. If utf16str is NULL, returns
+ * NULL. The return value should NOT be freed by the caller.
+ */
+gchar * utf_16to8(const wchar_t *utf16str);
+
+#endif /* _WIN32 */
+
#endif /* __STRUTIL_H__ */