How to Open and Run Python Files with UTF-8 Encoding in Jupyter Notebook?

16 Replies, 1227 Views

Hey everyone,
I’ve been trying to figure out how to jupyter-notebook open python with utf-8 encoding, but I’m kinda stuck.

I’ve got some Python files with non-ASCII characters, and when I open them in Jupyter Notebook, it’s all messed up. Like, special chars are showing as gibberish.

Anyone know how to make sure Jupyter reads the file with UTF-8 encoding? I tried a few things like adding `# -*- coding: utf-8 -*-` at the top of the script, but no luck.

Also, is there a way to set UTF-8 as the default encoding for opening files in Jupyter? Or do I have to do something manually every time?

Thanks in advance! Any tips or workarounds would be super helpful.

Cheers!

Messages In This Thread
How to Open and Run Python Files with UTF-8 Encoding in Jupyter Notebook? - by - 17-08-2024, 08:14 AM



Users browsing this thread: 1 Guest(s)