added QuotedPrintable{De,En}coder.
This commit is contained in:
		
							parent
							
								
									01df7ac29c
								
							
						
					
					
						commit
						02735ff4a1
					
				
					 7 changed files with 72 additions and 28 deletions
				
			
		
							
								
								
									
										42
									
								
								app/converter/quotedprintabledecoder.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								app/converter/quotedprintabledecoder.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| 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." | ||||
|  }; | ||||
|  } | ||||
|  } | ||||
|  }, | ||||
| 
 | ||||
|  */ | ||||
							
								
								
									
										18
									
								
								app/converter/quotedprintableencoder.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								app/converter/quotedprintableencoder.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| import {Converter} from "./converter"; | ||||
| 
 | ||||
| declare var window:any; | ||||
| 
 | ||||
| export class QuotedPrintableEncoder implements Converter { | ||||
| 
 | ||||
|     getDisplayname():string { | ||||
|         return "Encode quoted printable"; | ||||
|     } | ||||
| 
 | ||||
|     getId():string { | ||||
|         return "encodequotedprintable"; | ||||
|     } | ||||
| 
 | ||||
|     convert(input:string):string { | ||||
|         return window.quotedPrintable.encode(window.utf8.encode(input)); | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue