Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Fix JSON encodings - use utf-8 (#557)

Akshay Agrawalc946716e794c
diff --git a/marimo/_ast/codegen.py b/marimo/_ast/codegen.py
index c04b06a22d..e5b3e6b0b0 100644
--- a/marimo/_ast/codegen.py
+++ b/marimo/_ast/codegen.py
@@ -220,7 +220,7 @@ RECOVERY_CELL_MARKER = "ↁ"
def recover(filename: str) -> str:
"""Generate a module for code recovered from a disconnected frontend"""
- with open(filename, "r") as f:
+ with open(filename, "r", encoding="utf-8") as f:
contents = f.read()
cells = json.loads(contents)["cells"]
codes, names, configs = tuple(
diff --git a/marimo/_cli/ipynb_to_marimo.py b/marimo/_cli/ipynb_to_marimo.py
index 65c35d34c1..cd36da2853 100644
--- a/marimo/_cli/ipynb_to_marimo.py
+++ b/marimo/_cli/ipynb_to_marimo.py
@@ -18,7 +18,7 @@ def convert_from_path(ipynb_path: str) -> str:
.decode("utf-8")
)
else:
- with open(ipynb_path, "r") as f:
+ with open(ipynb_path, "r", encoding="utf-8") as f:
notebook = json.loads(f.read())
return convert(notebook)
diff --git a/marimo/_smoke_tests/code_editor.py b/marimo/_smoke_tests/code_editor.py
index 4997b4aa82..acb5185d1a 100644
--- a/marimo/_smoke_tests/code_editor.py
+++ b/marimo/_smoke_tests/code_editor.py
@@ -1,3 +1,4 @@
+# Copyright 2024 Marimo. All rights reserved.
import marimo
__generated_with = "0.1.76"