Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 183512: ordinal not in range(128) #2195

Open
cuppuluriupgrade opened this issue Jul 19, 2023 · 2 comments

Comments

@cuppuluriupgrade
Copy link

i have special characters in files I am trying to copy and want to keep them as such.
But ascii is hardcoded as shown below in the self._fp.write(s.encode('ascii', 'surrogateescape'))

Please help

File "/usr/local/lib/python3.8/site-packages/googleapiclient/discovery.py", line 1104, in method
    g.flatten(msgRoot, unixfrom=False)
  File "/usr/lib64/python3.8/email/generator.py", line 116, in flatten
    self._write(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 181, in _write
    self._dispatch(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 218, in _dispatch
    meth(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 276, in _handle_multipart
    g.flatten(part, unixfrom=False, linesep=self._NL)
  File "/usr/lib64/python3.8/email/generator.py", line 116, in flatten
    self._write(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 181, in _write
    self._dispatch(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 218, in _dispatch
    meth(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 436, in _handle_text
    super(BytesGenerator,self)._handle_text(msg)
  File "/usr/lib64/python3.8/email/generator.py", line 253, in _handle_text
    self._write_lines(payload)
  File "/usr/lib64/python3.8/email/generator.py", line 410, in write
    self._fp.write(s.encode('ascii', 'surrogateescape'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 1: ordinal not in range(128)

google-api-python-client==1.12.11

@cuppuluriupgrade
Copy link
Author

testing with api : drive

@agoncharov-reef
Copy link

Duplicate of #2091

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants