Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix encoding issue #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions danmaku/youtube-live-chat-danmaku-ass.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ def _load_mapped_emoji(self):
path = self._get_mapped_emoji_path()
if not os.path.isfile(path):
return {}
with open(path) as f:
with open(path, encoding='utf-8') as f:
return json.loads(f.read())

def _save_mapped_emoji(self):
path = self._get_mapped_emoji_path()
with open(path, 'w') as f:
with open(path, 'w', encoding='utf-8') as f:
f.write(json.dumps(self._url_by_emoji))

def _get_mapped_emoji_path(self):
Expand Down Expand Up @@ -547,8 +547,8 @@ def update_common_props(renderer):


def main():
input_buffer = sys.stdin if sys.argv[1] == '-' else open(sys.argv[1], 'r')
output_buffer = sys.stdout if sys.argv[2] == '-' else open(sys.argv[2], 'w')
input_buffer = sys.stdin if sys.argv[1] == '-' else open(sys.argv[1], 'r', encoding="utf-8")
output_buffer = sys.stdout if sys.argv[2] == '-' else open(sys.argv[2], 'w', encoding="utf-8")

ass_generator = DanmakuASSGenerator()
parser = YoutubeLiveChatReplayParser()
Expand Down