split quotedprintable and utf8 converters
This commit is contained in:
parent
242d733b01
commit
1835634d6c
5 changed files with 52 additions and 2 deletions
23
app/converter/utf8encoder.ts
Normal file
23
app/converter/utf8encoder.ts
Normal 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?");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue