Skip to content

Commit d8ed54e

Browse files
committed
Don't try to encode utf-8 to utf-8
1 parent 3ca3400 commit d8ed54e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/encoder.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,17 @@
2929
#define ICONV_CONST const
3030
#endif
3131

32+
static std::string filterUtf8Compatible(std::string enc) {
33+
#ifdef LCF_SUPPORT_ICU
34+
if (ucnv_compareNames(enc.c_str(), "UTF-8") == 0) {
35+
return "";
36+
}
37+
#endif
38+
return enc;
39+
}
40+
3241
Encoder::Encoder(std::string encoding)
33-
: _encoding(std::move(encoding))
42+
: _encoding(filterUtf8Compatible(std::move(encoding)))
3443
{
3544
Init();
3645
}

0 commit comments

Comments
 (0)