split quotedprintable and utf8 converters

This commit is contained in:
Manuel Friedli 2016-09-28 13:53:05 +02:00
parent 242d733b01
commit 1835634d6c
5 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,23 @@
import {Converter} from "./converter";
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
export class UTF8Encoder implements Converter {
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
}
getDisplayname():string {
return "Encode UTF-8";
}
getId():string {
return "encodeutf8";
}
convert(input:string):string {
try {
return this.nativeLibraryWrapperService.utf8.encode(input);
} catch (error) {
throw new Error("The input can not be encoded as UTF-8. May be corrupt?");
}
}
}