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 'utf8mb4' decode error,support 'utf8mb4' charset. #78

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion pymysqlreplication/binlogstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
freeze_schema: If true do not support ALTER TABLE. It's faster.
"""
self.__connection_settings = connection_settings
self.__connection_settings["charset"] = "utf8"
if not connection_settings.get("charset"):
self.__connection_settings["charset"] = "utf8"

self.__connected_stream = False
self.__connected_ctl = False
Expand Down
4 changes: 3 additions & 1 deletion pymysqlreplication/row_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def __add_fsp_to_time(self, time, column):
def __read_string(self, size, column):
string = self.packet.read_length_coded_pascal_string(size)
if column.character_set_name is not None:
string = string.decode(column.character_set_name)
character_set_name = "utf8" if column.character_set_name == "utf8mb4" \
else column.character_set_name
string = string.decode(character_set_name)
return string

def __read_bit(self, column):
Expand Down