Skip to content

node-mysql doesn't respect connection encoding #143

@angryziber

Description

@angryziber

node-mysql encodes all queries using utf8. This works fine, if mysql server's default encoding is also set to utf8, but storing of international characters is broken otherwise.

When opening a connection, the server specifies its default encoding, which is usually latin1 on new installations.
node-mysql can be fixed by sending SET NAMES 'utf8'; on connection if server uses something non-utf8.

As a workaround, to "fix" your mysql server, put 'default-character-set=utf8' into my.cnf/my.ini file.

And (optionally) run this on an already existing database:
alter database YOUR_DB character set utf8 collate utf8_general_ci;
alter table YOUR_TABLE charset=utf8;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions