1

I feel I'm a bit in over my head on this one. I have developed an ASP.Net MVC website for a friend that allows them to paste in Hebrew words and it does some conversion/translation. I am using MySQL as a data backend with ASP.Net MVC 5.

The website is fairly simple. The database consists of two tables which store letters, and translations. I am using MySQL EF6 for data access layer. There are basically three screens on the website, one for managing each table, and one for doing the translations.

When I run it in my development environment (VS 2017/Windows 10), everything works as expected. I can edit data using the Hebrew Unicode characters and they save properly to the database. Here is an example:

Hebrew Screenshot 1

When I click Save, I expect those values to be saved to the database, and they work fine. However, I have recently converted the website to run on a Mono/Ubuntu environment for hosting. I got the environment setup using mod_mono and Apache2. Everything is working perfectly, except when I save a page like this, the Hebrew character א gets converted into a question mark (?):

Hebrew Screenshot 2

Here's what I've determined so far.

  • I know Apache/MySQL is setup properly to handle these values, because the data displays fine. It only gets messed up when I save it.
  • I am also running PhpMyAdmin on the same server, and when I modify that same row through the table editor, it does not mess up the encoding.
  • I've tried adding the Default Encoding utf-8 to the Apache configuration with no luck.
  • I've tried adding globalization with default encodings of utf-8 to web.config and it didn't help.

How do I troubleshoot where the value is getting messed up? Is there a simple solution I need to apply to fix this?

Thanks!

mellamokb
  • 56,094
  • 12
  • 110
  • 136

1 Answers1

0
  • The bytes to be stored are not encoded as utf8/utf8mb4. Fix this.
  • The column in the database is CHARACTER SET utf8 (or utf8mb4). Fix this.
  • Also, check that the connection during reading is UTF-8.
  • HTML forms should start like <form accept-charset="UTF-8">.

For more discussion, see Trouble with utf8 characters; what I see is not what I stored

If that is not enough to solve your problem, find the HEX, as discussed in "Test the data" in that link; then ask for more help.

Community
  • 1
  • 1
Rick James
  • 135,179
  • 13
  • 127
  • 222