converter/src/app/converter/utf8decoder.js

23 lines
728 B
JavaScript

"use strict";
var UTF8Decoder = (function () {
function UTF8Decoder(nativeLibraryWrapperService) {
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
}
UTF8Decoder.prototype.getDisplayname = function () {
return "Decode UTF-8";
};
UTF8Decoder.prototype.getId = function () {
return "decodeutf8";
};
UTF8Decoder.prototype.convert = function (input) {
try {
return this.nativeLibraryWrapperService.utf8.decode(input);
}
catch (error) {
throw new Error("The input can not be interpreted a valid UTF-8 encoded string. May be corrupt?");
}
};
return UTF8Decoder;
}());
exports.UTF8Decoder = UTF8Decoder;