simplified quoted printable stuff

This commit is contained in:
Manuel Friedli 2016-09-20 22:10:32 +02:00
parent 57756c85a9
commit 9e95797211
2 changed files with 6 additions and 28 deletions

View file

@ -1,12 +1,10 @@
import {Converter} from "./converter"; import {Converter} from "./converter";
declare var window:any; declare var utf8:any;
declare var quotedPrintable:any;
export class QuotedPrintableDecoder implements Converter { export class QuotedPrintableDecoder implements Converter {
private utf8:any = window.utf8;
private quotedPrintable:any = window.quotedPrintable;
getDisplayname():string { getDisplayname():string {
return "Decode quoted printable"; return "Decode quoted printable";
} }
@ -16,27 +14,6 @@ export class QuotedPrintableDecoder implements Converter {
} }
convert(input:string):string { convert(input:string):string {
return this.utf8.decode(this.quotedPrintable.decode(input)); return utf8.decode(quotedPrintable.decode(input));
} }
} }
/*
{
"id": "decodequotedprintable",
"name": "Decode quoted printable",
"convert": function (input) {
try {
return {
"status": "OK",
"content": utf8.decode(quotedPrintable.decode(input))
};
} catch (exception) {
return {
"status": "ERROR",
"content": "Invalid quoted printable string."
};
}
}
},
*/

View file

@ -1,6 +1,7 @@
import {Converter} from "./converter"; import {Converter} from "./converter";
declare var window:any; declare var utf8:any;
declare var quotedPrintable:any;
export class QuotedPrintableEncoder implements Converter { export class QuotedPrintableEncoder implements Converter {
@ -13,6 +14,6 @@ export class QuotedPrintableEncoder implements Converter {
} }
convert(input:string):string { convert(input:string):string {
return window.quotedPrintable.encode(window.utf8.encode(input)); return quotedPrintable.encode(utf8.encode(input));
} }
} }