Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix tmux rendering issues by adding UTF-8 locale env vars to PTY (#1072)

Vasek Mlejnsky5aa1d245aaaa
diff --git a/.changeset/fix-tmux-rendering.md b/.changeset/fix-tmux-rendering.md
new file mode 100644
index 000000000..6547c5739
--- /dev/null
+++ b/.changeset/fix-tmux-rendering.md
@@ -0,0 +1,5 @@
+---
+"e2b": patch
+---
+
+Fix tmux rendering issues by adding UTF-8 locale environment variables (LANG, LC_ALL) to PTY creation. This fixes garbled Unicode and box-drawing characters when running applications like Claude Code inside tmux in E2B sandboxes.
diff --git a/packages/js-sdk/src/sandbox/commands/pty.ts b/packages/js-sdk/src/sandbox/commands/pty.ts
index 8224e2c79..714651c4e 100644
--- a/packages/js-sdk/src/sandbox/commands/pty.ts
+++ b/packages/js-sdk/src/sandbox/commands/pty.ts
@@ -98,7 +98,9 @@ export class Pty {
const requestTimeoutMs =
opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs
const envs = opts?.envs ?? {}
- envs.TERM = 'xterm-256color'
+ envs.TERM = envs.TERM ?? 'xterm-256color'
+ envs.LANG = envs.LANG ?? 'C.UTF-8'
+ envs.LC_ALL = envs.LC_ALL ?? 'C.UTF-8'
const controller = new AbortController()
const reqTimeout = setTimeout(() => {
diff --git a/packages/python-sdk/e2b/sandbox_async/commands/pty.py b/packages/python-sdk/e2b/sandbox_async/commands/pty.py
index b71d53b7c..3585b1324 100644
--- a/packages/python-sdk/e2b/sandbox_async/commands/pty.py
+++ b/packages/python-sdk/e2b/sandbox_async/commands/pty.py
@@ -126,7 +126,9 @@ class Pty:
:return: Handle to interact with the PTY
"""
envs = envs or {}
- envs["TERM"] = "xterm-256color"
+ envs.setdefault("TERM", "xterm-256color")
+ envs.setdefault("LANG", "C.UTF-8")
+ envs.setdefault("LC_ALL", "C.UTF-8")
events = self._rpc.astart(
process_pb2.StartRequest(
process=process_pb2.ProcessConfig(
diff --git a/packages/python-sdk/e2b/sandbox_sync/commands/pty.py b/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
index ea1b1dee5..fd936ef40 100644
--- a/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
+++ b/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
@@ -120,7 +120,9 @@ class Pty:
:return: Handle to interact with the PTY
"""
envs = envs or {}
- envs["TERM"] = "xterm-256color"
+ envs.setdefault("TERM", "xterm-256color")
+ envs.setdefault("LANG", "C.UTF-8")
+ envs.setdefault("LC_ALL", "C.UTF-8")
events = self._rpc.start(
process_pb2.StartRequest(
process=process_pb2.ProcessConfig(