locked
inserting special characters into MySQL RRS feed

  • Question

  • I'm having some problems storing special character into my MySQL database. Now I resolved this using encoding like described here. This solution works, but I'm not really happy about. The space character is replaced by ' '. For example, 'My varchar field' becomes 'My varchar field'. As you can see, a lot of extra data to save.

    When I don't do this, special chars (like € sign) are replace by '?'.

    When I use MySQL Administrator (and MySQL Query browser), I'm able to insert these special chars. Also, my colleague that uses PHP, is also able to store these chars. Thus MySQL is able to store these chars (using charset:latin1).

    So the problem looks like it has something to do with .NET or the MySQL Connector for .NET. My guess is that it has something to do with the character set.

    Does anyone has expierence insertin special chars into a MySQL DB? Or any one an idea how to solve this?
    • Moved by Harry Zhu Thursday, December 24, 2009 7:45 AM (From:Visual C# General)
    Wednesday, December 23, 2009 1:31 PM

All replies

  • hi,

    try to change the datatype of the DB field.......to nvarchar .........
    Nagarjuna Dilip
    Wednesday, December 23, 2009 1:36 PM
  • The result is the same. Still a question mark is inserted into the database,.

    Wednesday, December 23, 2009 2:25 PM
  • Hi,

    The question relating to MySQL is beyond the scope of c# forum, I'd recommend you try the MySQL forum :
    http://forums.mysql.com/list.php?38

    Thanks,
    Harry




    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, December 24, 2009 7:45 AM