I have a set of strings in unicode.
When I print these out to a file and cat
it, this can break my bash terminal: after catting the file, I will get "symbol salad" where everything is just random gibberish (including my command prompt).
I understand that this is probably related to the fact that the strings are unicode strings.
Currently, I am encoding them as ascii strings as follows: my_string.encode('ascii','ignore')
However, this deprecates a lot of data from the strings. Ideally, I would have some way to safely preserve all the unicode data in a file such that the user's terminal does not break when the file is catted.
What is the proper way to do this?