42 lines
796 B
TypeScript
42 lines
796 B
TypeScript
import {Converter} from "./converter";
|
|
|
|
declare var window:any;
|
|
|
|
export class QuotedPrintableDecoder implements Converter {
|
|
|
|
private utf8:any = window.utf8;
|
|
private quotedPrintable:any = window.quotedPrintable;
|
|
|
|
getDisplayname():string {
|
|
return "Decode quoted printable";
|
|
}
|
|
|
|
getId():string {
|
|
return "decodequotedprintable";
|
|
}
|
|
|
|
convert(input:string):string {
|
|
return this.utf8.decode(this.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."
|
|
};
|
|
}
|
|
}
|
|
},
|
|
|
|
*/ |