views:

403

answers:

0

Hey,

I have populated a MySQL table with utf-8 strings (using a python script).
You can assume that the string in the DB was correctly encoded (I've verified this by extracting the string from MySQL Query Browser and running a utf-8 decode... got my original unicode string).

Now the problem begins when I try to load this string using NHibernate.
NHibernate should supposedly use utf-8 to decode the string stored in the DB. Instead, it decodes it incorrectly, and you get human-unreadable unicode. I have no idea what type of decoder it uses.

The correct utf-8 form of an example string (this is how it is stored in the DB):

(226, 128, 152 = left quote) (226, 128, 153 = right quote)

NHiberante generated the following Unicode characters:

226, 8364, 732, 226, 8364, 8482

Things I've already tried:

  • Update to the latest MySQLConnector/Net
  • append ;charSet=utf8 to the MySQL connection string
  • Use AnsiString type in my mapping file
  • Set the table and column charset to utf-8 (in MySQL)

Nothing helped. I'm clueless at this point. Any help would be much appreciated!