Merge pull request #329 from glowing-bear/invalidchars
Catch broken UTF-8 to enable loading of buffers with broken lines
This commit is contained in:
commit
87be4cdbfc
1 changed files with 7 additions and 4 deletions
|
@ -574,10 +574,13 @@
|
|||
WeeChatProtocol._uia2s = function(uia) {
|
||||
if(!uia.length || uia[0] === 0) return "";
|
||||
|
||||
var encodedString = String.fromCharCode.apply(null, uia),
|
||||
decodedString = decodeURIComponent(escape(encodedString));
|
||||
|
||||
return decodedString;
|
||||
try {
|
||||
var encodedString = String.fromCharCode.apply(null, uia),
|
||||
decodedString = decodeURIComponent(escape(encodedString));
|
||||
return decodedString;
|
||||
} catch (exception) {
|
||||
return "--Sorry, Glowing Bear cannot decode this line as it is invalid--";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue