Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created February 26, 2024 16:28
Show Gist options
  • Save ychaouche/e38eb467d43e12d93bdf5a9639463561 to your computer and use it in GitHub Desktop.
Save ychaouche/e38eb467d43e12d93bdf5a9639463561 to your computer and use it in GitHub Desktop.
$ python3.6 unicodepython3.6 "j'ai réussi à écrire une version plus concise"
Traceback (most recent call last):
File "unicodepython3.6", line 9, in <module>
print(f"usertext was {usertext}")
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 19-20: surrogates not allowed
$ cat unicodepython3.6
#!/usr/bin/python
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument("usertext",help="text to translate")
args=argparser.parse_args()
usertext = args.usertext
print(f"usertext was {usertext}")
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment