question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non english characters are replaced with question marks sometimes (mysql)

See original GitHub issue

We found out today, that some non english charcacter doesn’t get saved properly to the database. Some of them get replaced by a questionmark, some by two, sometimes it works fine. This only happens if you use a mysql backend

I was able to figure out an example that always fails. Set up an etherpad lite instance with mysql, copy paste this string привет into a pad, restart etherpad lite and reload the pad. You will see that your string got replaced by questionmarks

This results in ueberDB in this sql command

REPLACE INTO `store` VALUES ('pad:test3', '{\"atext\":{\"text\":\"Welcome to Etherpad Lite!\\n\\nThis pad text is syncприветhronized as you type, приветso that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\\n\\nEtherpad Lite on Github: http://j.mp/ep-lite\\n\\n\",\"attribs\":\"|2+r+l*0+6+m*0+6|4+4e\"},\"pool\":{\"numToAttrib\":{\"0\":[\"author\",\"a.L7J3iR4yRjzJJJVc\"]},\"nextNum\":1},\"head\":2,\"chatHead\":-1,\"publicStatus\":false,\"passwordHash\":null}'),('pad:test3:revs:2', '{\"changeset\":\"Z:6i>6|2=r=l*0+6$привет\",\"meta\":{\"author\":\"a.L7J3iR4yRjzJJJVc\",\"timestamp\":1330620479659}}');

If I paste this sql command into phpmyadmin, the special chars gets replaced with question marks too. It looks like the node mysql driver doesn’t escape this chars properly, or the database scheme can not work with such chars

Any help to solve that problem is appreciated

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jhollingercommented, Mar 1, 2012

In mysql, each table has its own character set, and it usually defaults to latin1. This is probably causing the issue. (The charset can also be set for each connection. They should match.) The charset should probably be UTF-8. I think something like this should fix the db:

ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
0reactions
marcelklehrcommented, Jun 26, 2013

Not taking into account the possible additional magic that encodeURIComponent performs, this might be a solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are question marks replacing certain characters in mysql ...
There are several steps to make a page work correctly. See "question mark" in Trouble with UTF-8 characters; what I see is not...
Read more >
Characters appear as question marks using MySQL
Problem. Certain characters (Cyrillic or Japanese, for example) appear as question marks "????" even though encoding has already been set to ...
Read more >
Certain characters replaced by question marks - PHP - SitePoint
I am not sure if this is a database question but certain characters like apostrophe are getting replaced with question marks.
Read more >
MySQL Chinese, Japanese, and Korean Character Sets
It is also possible to store CJK characters in Unicode character sets, although the ... in which case the “bad” characters are changed...
Read more >
Unicode characters turn into question marks - concrete5
I am not familiar with with the Administrator program. If you have the ability to look at the database variables (mysql> show variables;),...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found