Search code examples
memgraphdb

Problem with UNICODE characters in substrings


I've used the following code to create a node:

memgraph> CREATE (n:Node {city: 'København'}) RETURN n;
+------------------------------+
| n                            |
+------------------------------+
| (:Node {city: "København"}) |
+------------------------------+
1 row in set (round trip in 0.003 sec)
1 labels have been created.
1 nodes have been created.

When I try to return substring sometimes Unicode character is shown correctly, other times not nut the count is off when it is displayed corecttly.

memgraph> MATCH (n:Node) RETURN substring(n.city, 0, 1);
+-------------------------+
| substring(n.city, 0, 1) |
+-------------------------+
| "K"                     |
+-------------------------+
1 row in set (round trip in 0.000 sec)
memgraph> MATCH (n:Node) RETURN substring(n.city, 0, 2);
+-------------------------+
| substring(n.city, 0, 2) |
+-------------------------+
| "K�"                    |
+-------------------------+
1 row in set (round trip in 0.001 sec)
memgraph> MATCH (n:Node) RETURN substring(n.city, 0, 3);
+-------------------------+
| substring(n.city, 0, 3) |
+-------------------------+
| "Kø"                   |
+-------------------------+
1 row in set (round trip in 0.001 sec)
memgraph> MATCH (n:Node) RETURN substring(n.city, 0, 4);
+-------------------------+
| substring(n.city, 0, 4) |
+-------------------------+
| "Køb"                  |
+-------------------------+
1 row in set (round trip in 0.000 sec)

How can I resolve this issue?


Solution

  • This is a known bug and there is an GitHub issue. You will need to wait for the fix.