EncodeToAscii
Input Text Data to Encode as ASCII (Ignores any chars that aren't interpreted as ASCII).
python · Common Scripts
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 """ MAIN FUNCTION """ def main(): # Grab 'data' from Demisto Arguments data = demisto.args()["data"] # Encode the data, ignoring characters try: encoded_data = data.encode("ascii", "ignore").decode("utf-8") except Exception as e: return_error(f"There was an error encoding the data.\nError:\n{e!s}") # Output the data and add results to war room return_results( CommandResults(readable_output=f"Success: {encoded_data}", outputs_prefix="asciiencode.encoded", outputs=encoded_data) ) """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): main()
README
Returns inputed text data that will be encoded into ASCII. This ignores any chars that can’t be interpreted as ASCII.
Script Data
| Name | Description |
|---|---|
| Script Type | python |
| Tags | - |
Inputs
| Argument Name | Description |
|---|---|
| data | The data to be encoded. |
Outputs
| Path | Description | Type |
|---|---|---|
| asciiencode.encoded | The data encoded in ASCII. | string |