From 5e392cf34f8e062dd0533619921223656e32598a Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 29 Jan 2021 13:09:17 +0100 Subject: Refactor utf8_to_wide/wide_to_utf8 functions --- src/util/string.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/util/string.h') diff --git a/src/util/string.h b/src/util/string.h index 6fd11fadc..ec14e9a2d 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -64,11 +64,13 @@ 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 +// Try to avoid converting between wide and UTF-8 unless 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); +// You must free the returned string! +// The returned string is allocated using new[] wchar_t *utf8_to_wide_c(const char *str); // NEVER use those two functions unless you have a VERY GOOD reason to -- cgit v1.2.3