Why is AspNet 6 System DateTime showing Chinese Characters


Question: Asp.Net 6 all of the sudden started showing dates in Chinese, what is going on? the date shows like this:

Date'Date = {2022/4/25 ??12:00:00}

When I try to parse the DateTime, the error is thrown saying 
\"FormatException:'>#fbeeb8;\">FormatException: String '??0422' was not recognized as a valid DateTime\"

How do I get rid of the Chinese Characters in the DateTime?


Login to See the Rest of the Answer

Answer:
There is a big chance that you were testing the #Globalization or #Localization feature in Asp.Net Core or Asp.Net 6. As a result, this has cached or changed the state-machine in your compiler. 

In order to get a ride of #Chinese Characters in a #DateTime from C-Sharp code is by removing the app.UseRquestLocalization(options.Value);<br'>#bfedd2;\">app.UseRquestLocalization(options.Value);<br />
The Globalization #Middleware has cached the language state of Chinese, that is why you are seeing the Chinese symbols in the System.DateTime.

After removing the middleware the date should now as normal. If this helped you or gave you an idea that lead to solving your problem, please let us know below in the Comments Section.

 








© 2024 - ErnesTech - Privacy
E-Commerce Return Policy