diff options
author | sfan5 <sfan5@live.de> | 2021-01-29 13:09:17 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-02-02 20:46:08 +0100 |
commit | 5e392cf34f8e062dd0533619921223656e32598a (patch) | |
tree | f7cbd5f6d5290545adb4ce0beb07a94352043818 /src/util/string.h | |
parent | 7ebd5da9cd4a227dcdc140a495f264a97277b3a3 (diff) | |
download | minetest-5e392cf34f8e062dd0533619921223656e32598a.tar.gz minetest-5e392cf34f8e062dd0533619921223656e32598a.tar.bz2 minetest-5e392cf34f8e062dd0533619921223656e32598a.zip |
Refactor utf8_to_wide/wide_to_utf8 functions
Diffstat (limited to 'src/util/string.h')
-rw-r--r-- | src/util/string.h | 6 |
1 files changed, 4 insertions, 2 deletions
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 |