Skip to content

Commit

Permalink
Merge pull request #115 from Ghabry/icu
Browse files Browse the repository at this point in the history
Accept ambigious icu encodings (like windows-1252)
  • Loading branch information
fdelapena committed Jul 2, 2014
2 parents f12b80e + 3fb817e commit d8f6a45
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/reader_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ std::string ReaderUtil::Recode(const std::string& str_to_encode,
std::string result_str;

conv = ucnv_open(encoding_str.c_str(), &status);

if (status != U_ZERO_ERROR && status != U_AMBIGUOUS_ALIAS_WARNING) {
return std::string();
}
status = U_ZERO_ERROR;

length = ucnv_toUChars(conv, unicode_str, size, str_to_encode.c_str(), -1, &status);
ucnv_close(conv);
if (status != U_ZERO_ERROR) return std::string();
Expand Down

0 comments on commit d8f6a45

Please sign in to comment.