My problem is using C # and a MySQL database to save some records by sending parameters.
Although I have already set the encoding as Utf-8, and I can correctly see Unicode characters, the problem I get when trying to insert Unicode characters is that it only saves half the string.
It is really strange that this happens only with Unicode strings, such as Greek words, and only when I send a request with parameters.
Those. if my request, as shown in C #, is as follows:
string query = "INSERT INTO tablename VALUES (NULL, @somestring)";
and I set the @somestring parameter value to "TESTING". It will be very good.
If I try to set the value as a Unicode string "ΤΕΣΤΙΝΓ", the query is executed perfectly without errors, but it only stores half the characters in the database, i.e. he only saves "ΤΕΣΤ".
On the other hand, if I remove the parameters and configure the query as:
string somestring = "ΤΕΣΤΙΝΓ"; string query = "INSERT INTO tablename VALUES (NULL,'" + somestring + "')";
the query again works just fine and saves the entire word / sentence in the database.
Hope I explained it correctly and you can understand my situation.
thanks
source share