Split utf8 from quoted printable
This commit is contained in:
parent
644c3c42b6
commit
9b29d638d1
4 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ import {Converter} from "./converter";
|
|||
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
|
||||
|
||||
export class QuotedPrintableDecoder implements Converter {
|
||||
|
||||
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Converter} from "./converter";
|
|||
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
|
||||
|
||||
export class QuotedPrintableEncoder implements Converter {
|
||||
|
||||
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
|
||||
}
|
||||
|
||||
|
|
24
src/app/converter/utf8decoder.ts
Normal file
24
src/app/converter/utf8decoder.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import {Converter} from "./converter";
|
||||
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
|
||||
|
||||
export class UTF8Decoder implements Converter {
|
||||
|
||||
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
|
||||
}
|
||||
|
||||
getDisplayname():string {
|
||||
return "Decode UTF-8";
|
||||
}
|
||||
|
||||
getId():string {
|
||||
return "decodeutf8";
|
||||
}
|
||||
|
||||
convert(input:string):string {
|
||||
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?");
|
||||
}
|
||||
}
|
||||
}
|
24
src/app/converter/utf8encoder.ts
Normal file
24
src/app/converter/utf8encoder.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
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