From 5e10f1133bb872e112f4e97264f024978e72e9d8 Mon Sep 17 00:00:00 2001 From: Hombre Date: Sat, 3 Mar 2018 16:03:15 +0100 Subject: [PATCH] Fix UTF16 support for EXIF.UserComment on behalf of floessie Issue reported here https://discuss.pixls.us/t/call-for-testing-rawtherapee-5-4-rc2/6828/9 --- rtexif/rtexif.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index b6a60bbd8..ff5607b02 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1948,8 +1948,8 @@ void Tag::initUserComment (const Glib::ustring &text) memcpy(value, "ASCII\0\0\0", 8); memcpy(value + 8, text.c_str(), valuesize - 8); } else { - wchar_t *commentStr = (wchar_t*)g_utf8_to_utf16 (text.c_str(), -1, nullptr, nullptr, nullptr); - size_t wcStrSize = wcslen(commentStr); + glong wcStrSize = 0; + gunichar2 *commentStr = g_utf8_to_utf16 (text.c_str(), -1, nullptr, &wcStrSize, nullptr); valuesize = count = wcStrSize * 2 + 8 + (useBOM ? 2 : 0); value = new unsigned char[valuesize]; memcpy(value, "UNICODE\0", 8);