Skip to content

Commit d2c8bb0

Browse files
authored
fix(logger): set utf-8 encoding (#223)
1 parent f516594 commit d2c8bb0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
install_requires = [
2121
'flask>=2.1.2', 'functions-framework>=3.0.0', 'firebase-admin>=6.0.0',
2222
'pyyaml>=6.0', 'typing-extensions>=4.4.0', 'cloudevents==1.9.0',
23-
'flask-cors>=3.0.10', 'pyjwt[crypto]>=2.5.0', 'google-events>=0.5.0',
23+
'flask-cors>=3.0.10', 'pyjwt[crypto]>=2.5.0', 'google-events==0.5.0',
2424
'google-cloud-firestore>=2.11.0'
2525
]
2626

src/firebase_functions/logger.py

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
import typing as _typing
99
import typing_extensions as _typing_extensions
1010

11+
# If encoding is not 'utf-8', change it to 'utf-8'.
12+
if _sys.stdout.encoding != "utf-8":
13+
_sys.stdout.reconfigure(encoding="utf-8") # type: ignore
14+
if _sys.stderr.encoding != "utf-8":
15+
_sys.stderr.reconfigure(encoding="utf-8") # type: ignore
16+
1117

1218
class LogSeverity(str, _enum.Enum):
1319
"""

0 commit comments

Comments
 (0)