From 572990dcd3f43386860b5b14015ad722fb96ea83 Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 10 Jun 2015 00:35:21 +0200 Subject: Add utf-8 conversion utilities and re-add intlGUIEditBox --- src/util/string.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/util/string.h') diff --git a/src/util/string.h b/src/util/string.h index b80e3c9a8..5bf2b5b7c 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -39,10 +39,18 @@ struct FlagDesc { u32 flag; }; +// try not to convert between wide/utf8 encodings; this can result in data loss +// try to only convert between them when you need to input/output stuff via Irrlicht +std::wstring utf8_to_wide(const std::string &input); +std::string wide_to_utf8(const std::wstring &input); + +// NEVER use those two functions unless you have a VERY GOOD reason to +// they just convert between wide and multibyte encoding +// multibyte encoding depends on current locale, this is no good, especially on Windows + // You must free the returned string! // The returned string is allocated using new wchar_t *narrow_to_wide_c(const char *str); - std::wstring narrow_to_wide(const std::string &mbs); std::string wide_to_narrow(const std::wstring &wcs); -- cgit v1.2.3