Ignore errors regarding invalid UTF-8 strings in Matroska files instead of erroring out

This commit is contained in:
Moritz Bunkus 2010-12-26 11:25:20 +01:00
parent b905d05add
commit d63e8f150a
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2010-12-26 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: enhancement: If mkvmerge encounters invalid UTF-8
strings in Matroska files then those strings will simply be cut
short. Before mkvmerge was exiting with an error ("Invalid UTF-8
sequence encountered").
* all: new feature: Added online update checks. The command line
tools know a new parameter "--check-for-updates". mmg has a new
menu entry ("Help" -> "Check for updates") and checks

View File

@ -97,15 +97,15 @@ cstrutf8_to_UTFstring(const std::string &c) {
for (src = 0; src < slen; dlen++) {
clen = utf8_byte_length(c[src]);
if (clen < 0)
mxerror(Y("cstrutf8_to_UTFstring: Invalid UTF-8 sequence encountered. Please contact moritz@bunkus.org and request that he implements a better UTF-8 parser."));
return u;
src += clen;
}
new_string = (wchar_t *)safemalloc((dlen + 1) * sizeof(wchar_t));
for (src = 0, dst = 0; src < slen; dst++) {
clen = utf8_byte_length(c[src]);
if ((src + clen) > slen)
mxerror(Y("cstrutf8_to_UTFstring: Invalid UTF-8 sequence encountered. Please contact moritz@bunkus.org and request that he implements a better UTF-8 parser."));
if ((clen < 0) || ((src + clen) > slen))
break;
if (clen == 1)
new_string[dst] = c[src];