Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(project): force utf-8 so project creation survives c locale (#62269)

Dylan Martin4c57d2aa20a7
diff --git a/Dockerfile b/Dockerfile
index 6e2708d9f167..373524551ead 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -188,6 +188,11 @@ FROM unit:1.34.2-python3.13
WORKDIR /code
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
ENV PYTHONUNBUFFERED 1
+# Unit embeds libpython instead of launching the python3 CLI, so PEP 538 C-locale
+# coercion never runs and open() defaults to ASCII under the container's bare locale.
+# Force UTF-8 so file reads with non-ASCII bytes don't raise UnicodeDecodeError.
+ENV PYTHONUTF8 1
+ENV LANG C.UTF-8
ARG UNIT_GIT_TAG=1.35.0
ARG UNIT_GIT_REF=28404105810f53c570523c3e70006ad0ca210e58
diff --git a/posthog/helpers/generic_emails.txt b/posthog/helpers/generic_emails.txt
index 240efc72e588..7b35b1c2b320 100644
--- a/posthog/helpers/generic_emails.txt
+++ b/posthog/helpers/generic_emails.txt
@@ -173,7 +173,7 @@ asurfer.com
athenachu.net
atina.cl
atl.lv
-atlanticbb.net 
+atlanticbb.net
atlaswebmail.com
atlink.com
ato.check.com
diff --git a/posthog/migrations/0132_team_test_account_filters.py b/posthog/migrations/0132_team_test_account_filters.py
index a1aba896aa28..a210f183f206 100644
--- a/posthog/migrations/0132_team_test_account_filters.py
+++ b/posthog/migrations/0132_team_test_account_filters.py
@@ -22,7 +22,7 @@ class GenericEmails:
"""
def __init__(self):
- with open(get_absolute_path("../helpers/generic_emails.txt")) as f:
+ with open(get_absolute_path("../helpers/generic_emails.txt"), encoding="utf-8") as f:
self.emails = {x.rstrip(): True for x in f}
def is_generic(self, email: str) -> bool:
diff --git a/posthog/utils.py b/posthog/utils.py
index 30aa53e57f21..0db6a4da93dc 100644
--- a/posthog/utils.py
+++ b/posthog/utils.py
@@ -1416,7 +1416,7 @@ class GenericEmails:
"""
def __init__(self):
- with open(get_absolute_path("helpers/generic_emails.txt")) as f:
+ with open(get_absolute_path("helpers/generic_emails.txt"), encoding="utf-8") as f:
self.emails = {x.rstrip(): True for x in f}
def is_generic(self, email: str) -> bool: