[ASP.NET MVC] Khắc phục lỗi chữ tiếng việt Unicode bị encode trong View

When you build a website with Vietnamese in it, the worst part is Vietnamese text getting encoded into meaningless characters
This affects a lot of things, especially SEO, storing data in the DB, and so on and so forth.
So how do you fix it?
The root cause
The silly reason is that Vietnamese has some characters that collide with latin characters (in this table: http://www.akadia.com/services/iso8859.html)
To avoid confusion with those latin characters, plenty of programming languages automatically encode these characters into a string the machine can understand
What is that string?
Use this page to convert back and forth online and you’ll see: https://r12a.github.io/apps/conversion/
ASP.NET converts that string into a form of code called the “Unicode Decimal Code”. For example: http://www.codetable.net/decimal/224
The fix
- Open the Web.config file
- Find the
<system.web>tag - Add:
<globalization fileEncoding="utf-8" />
The result:

That’s it :D
If you have a better fix, let me know