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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: CLI print for non UTF-8 terminals (#5397)
Akshay Agrawal99cddb0dee76
diff --git a/marimo/_cli/print.py b/marimo/_cli/print.pyindex 4d18b9fb6b..57c33931e8 100644--- a/marimo/_cli/print.py+++ b/marimo/_cli/print.py@@ -76,13 +76,32 @@ def muted(text: str) -> str:return "\033[37;2m" + text + "\033[0m" if _USE_COLOR else text-def echo(*args: Any, **kwargs: Any) -> None:- if GLOBAL_SETTINGS.QUIET:- return-+def _echo_or_print(*args: Any, **kwargs: Any) -> None:try:import clickclick.echo(*args, **kwargs)except ModuleNotFoundError:print(*args, **kwargs) # noqa: T201+++def echo(*args: Any, **kwargs: Any) -> None:+ if GLOBAL_SETTINGS.QUIET:+ return++ try:+ _echo_or_print(*args, **kwargs) # noqa: T201+ except UnicodeEncodeError:+ # Handle non-UTF-8 terminals (such as CP-1252, Windows) by replacing+ # common Unicode characters with ASCII equivalents for non-UTF-8+ # terminals.+ ascii_args = []+ for arg in args:+ if isinstance(arg, str):+ ascii_arg = arg.replace("→", "->").replace("←", "<-")+ ascii_arg = ascii_arg.replace("✓", "v").replace("✗", "x")+ ascii_arg = ascii_arg.replace("•", "*").replace("…", "...")+ ascii_args.append(ascii_arg)+ else:+ ascii_args.append(arg)+ _echo_or_print(*ascii_args, **kwargs)