Fix broken error check for iconv_open() result in iso_to_utf8()
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 31 Dec 2025 10:37:07 +0000 (11:37 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 31 Dec 2025 10:44:54 +0000 (11:44 +0100)
The variable 'i2utf8' was misspelled as the function name 'iso_to_utf8'
in the error check. This would cause the error condition to always be false,
preventing proper detection of iconv_open() failures.

Luckily ISO-8859-1 to UTF-8 should always be available.

src/stringfunc.cpp

index c6050f4..0e353d5 100644 (file)
@@ -786,7 +786,7 @@ std::string iso_to_utf8(const std::string& isostring)
 
    iconv_t i2utf8 = iconv_open("UTF-8", "ISO-8859-1");
 
-   if (iso_to_utf8 == (iconv_t)-1)
+   if (i2utf8 == (iconv_t)-1)
       throw runtime_error("iconv can't convert from ISO-8859-1 to UTF-8");
 
    size_t in_size=isostring.size();