From: Steven R. Loomis Date: Sat, 25 Mar 2017 00:09:23 +0000 (+0000) Subject: ICU-12766 fix unescape on EBCDIC X-Git-Tag: release-59-rc~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e20856d499a1edc67b5b2ebd6c2e765eadb40c9b;p=icu ICU-12766 fix unescape on EBCDIC * increment error * need to do UTF-8 decode at the original location, not the modified one X-SVN-Rev: 39935 --- diff --git a/icu4c/source/tools/escapesrc/escapesrc.cpp b/icu4c/source/tools/escapesrc/escapesrc.cpp index 4bca5025bd1..6f97be4e9a4 100644 --- a/icu4c/source/tools/escapesrc/escapesrc.cpp +++ b/icu4c/source/tools/escapesrc/escapesrc.cpp @@ -157,21 +157,27 @@ bool fixu8(std::string &linestr, size_t origpos, size_t &endpos) { outstr += '\"'; // local encoding for(;pos0; pos++,trail--) { + for(size_t pos2 = pos+1; trail>0; pos2++,trail--) { linestr[pos2] = cp1047_to_8859(linestr[pos2]); } #endif // Proceed to decode utf-8 const uint8_t *s = (const uint8_t*) (linestr.c_str()); - int32_t i = pos; int32_t length = linestr.size(); UChar32 c; if(U8_IS_SINGLE((uint8_t)s[i]) && oldIllegal[s[i]]) { @@ -263,7 +270,7 @@ bool fixAt(std::string &linestr, size_t pos) { U8_NEXT(s, i, length, c); } if(c<0) { - fprintf(stderr, "Illegal utf-8 sequence\n"); + fprintf(stderr, "Illegal utf-8 sequence at Column: %d\n", old_pos); fprintf(stderr, "Line: >>%s<<\n", linestr.c_str()); return true; }