Skip to content

Commit 252e64e

Browse files
committed
Try set utf-8 on console
1 parent 0050a81 commit 252e64e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.github/workflows/unittest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
7373
run: pip install -r docker_requirements.txt
7474
- name: Install PyThaiNLP
75+
env:
76+
PYTHONIOENCODING: utf-8
7577
run: pip install .
7678
# If you want to install a safe small set of optional dependencies, use:
7779
# pip install .[compact]

pythainlp/cli/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
# SPDX-License-Identifier: Apache-2.0
44
"""Command line helpers."""
55

6+
import io
67
import sys
78
from argparse import ArgumentParser
89

10+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
11+
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8")
12+
913
# a command should start with a verb when possible
1014
COMMANDS = sorted(["data", "soundex", "tag", "tokenize", "benchmark"])
1115

0 commit comments

Comments
 (0)