Python Forum
[SOLVED] [Debian] UnicodeEncodeError: 'ascii' codec
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] [Debian] UnicodeEncodeError: 'ascii' codec
#1
Helllo,

I get this error when running a script on a Debian 11 host (Python 3.5.3), apparently because the web site I call through requests() returns UTF8 data:

UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 112: ordinal not in range(128)

In this article, the only thing that works is this:

~# export PYTHONIOENCODING=utf8

How can I make it 1) sticky, and 2) possible to run the script through cron?

Thank you.
Reply


Messages In This Thread
[SOLVED] [Debian] UnicodeEncodeError: 'ascii' codec - by Winfried - Nov-16-2022, 10:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 562: ord ctrldan 23 5,035 Apr-24-2023, 03:40 PM
Last Post: ctrldan
  UnicodeEncodeError - Dealing with Japanese Characters fioranosnake 2 2,522 Jul-07-2022, 08:43 PM
Last Post: fioranosnake
  UnicodeEncodeError: 'ascii' codec can't encode character '\xfd' in position 14: ordin Armandito 6 2,806 Apr-29-2022, 12:36 PM
Last Post: Armandito
  UnicodeEncodeError caused by print when program runs from Popen SheeppOSU 5 2,971 Jan-13-2022, 08:11 AM
Last Post: SheeppOSU
  [UnicodeEncodeError from smtplib] yoohooos 0 3,423 Sep-25-2021, 04:27 AM
Last Post: yoohooos
  ASCII-Codec in Python3 [SOLVED] AlphaInc 4 6,239 Jul-07-2021, 07:05 PM
Last Post: AlphaInc
  codec for byte transparency Skaperen 7 3,896 Sep-25-2020, 02:20 AM
Last Post: Skaperen
  Run script on startup in Debian with systemd? MrGlasspoole 5 3,702 Jul-12-2020, 11:48 AM
Last Post: MrGlasspoole
  'charmap' codec louis216 4 20,285 Jun-30-2020, 06:25 AM
Last Post: louis216
  Which codec can help me decode the html source? vivekagrey 4 3,237 Jan-10-2020, 09:33 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020