23 lines
704 B
JavaScript
23 lines
704 B
JavaScript
|
"use strict";
|
||
|
var UTF8Encoder = (function () {
|
||
|
function UTF8Encoder(nativeLibraryWrapperService) {
|
||
|
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||
|
}
|
||
|
UTF8Encoder.prototype.getDisplayname = function () {
|
||
|
return "Encode UTF-8";
|
||
|
};
|
||
|
UTF8Encoder.prototype.getId = function () {
|
||
|
return "encodeutf8";
|
||
|
};
|
||
|
UTF8Encoder.prototype.convert = function (input) {
|
||
|
try {
|
||
|
return this.nativeLibraryWrapperService.utf8.encode(input);
|
||
|
}
|
||
|
catch (error) {
|
||
|
throw new Error("The input can not be encoded as UTF-8. May be corrupt?");
|
||
|
}
|
||
|
};
|
||
|
return UTF8Encoder;
|
||
|
}());
|
||
|
exports.UTF8Encoder = UTF8Encoder;
|