Why does the ContentResult controller in ASP.NET MVC return UTF-16 when UTF-8 is specified?

I have an ActionResult that returns XML for an embedded device. Relevant Code:

return Content(someString, "text/xml", Encoding.UTF8);

Although UTF-8 is specified, the resulting XML:

<?xml version="1.0" encoding="utf-16"?>

ASP.NET MVC compiles as AnyCPU and runs on a Windows 2008 server.

Why doesn't it return XML-encoded UTF-8?

+3
source share
1 answer

HTTP XML, . XML, , UTF-8. ContentResult , , XML . ContentResult, , Response.Write(Content) - .

+10

Source: https://habr.com/ru/post/1720009/


All Articles