* @param {string} input * @param {Object[]} args * @returns {json}
(input, args)
| 50 | * @returns {json} |
| 51 | */ |
| 52 | run(input, args) { |
| 53 | const output = {}, |
| 54 | charsets = Object.keys(CHR_ENC_CODE_PAGES), |
| 55 | mode = args[0]; |
| 56 | |
| 57 | charsets.forEach(charset => { |
| 58 | try { |
| 59 | if (mode === "Decode") { |
| 60 | output[charset] = cptable.utils.decode(CHR_ENC_CODE_PAGES[charset], input); |
| 61 | } else { |
| 62 | output[charset] = Utils.arrayBufferToStr(cptable.utils.encode(CHR_ENC_CODE_PAGES[charset], input)); |
| 63 | } |
| 64 | } catch (err) { |
| 65 | output[charset] = "Could not decode."; |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | return output; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Displays the encodings in an HTML table for web apps. |
nothing calls this directly
no test coverage detected