Hebrew Problem - MySql, C #

I have a problem with entering Hebrew strings in MySql.

Introduction

  • I installed MySql in Utf8.
  • I set the table as charset utf8 with sorting uft8_general_ci
  • I set the connection string like this: "Server =; Database =; Uid =; Pwd =; charset = utf8;"
  • I am writing a stored procedure for using it with C #.
  • MySql Version: 5.1.53

when I just insert a Hebrew row into a MySql table like this:

insert into temp_table (temp_column) values ('ערך') 

I saw how right. if I set a stored procedure like this ... I see gibberish.

when I call it using C #, I get an exception like "Invalid string value:" \ xD7 \ xAA \ xD7 \ xA8 ... "for the column ... '

if I insert English strings, so I get everything right.

any idea?

+2
source share
3 answers

i added to charset utf8 stored procedure

in SP_CityName VARCHAR (100) charset utf8, in SP_CitySynonyms mediumtext charset utf8

and now it works great ... many thanks to all.

+1
source

You said that you set the table as UTF8 encoding, but you also set the column encoding to UTF8?

And / or try sending the SET NAMES utf8; command SET NAMES utf8; on MySql before executing the stored procedure.

SET NAMES indicates which character set the client will use to send SQL statements to the server. Thus, SET NAMES 'cp1251' tells the server, "future incoming messages from this client are in the cp1251 character set." It also indicates the character set that the server should use to send returns to the client. (For example, it indicates which character to use for column values ​​if you use the SELECT statement.)

+2
source

Use the text / LongText instead of varchar. Also use Collation as utf8_general_ci

0
source

All Articles