代码之家  ›  专栏  ›  技术社区  ›  UbuntuCore

ASP.NET核心视图中的非英语字符显示为

  •  1
  • UbuntuCore  · 技术社区  · 6 年前

    我无法显示非英语字母,如:

    <h3>żąćń</h3> 因为它显示为

    • <meta charset="ISO-8859-1">
    • <meta charset="ISO-8859-2">
    • <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    • <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
    • <meta charset="UTF-8">

    head 页面布局中的节,它位于html源代码视图中。

    也:

            services.Configure<WebEncoderOptions>(options =>
            {
                options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All);
            });
    

    你知道怎么解决吗?

    2 回复  |  直到 6 年前
        1
  •  2
  •   Sergio Unradelic    6 年前

    我认为您应该尝试查找实际文件上的文件格式(使用一些软件读取/写入其内容,例如 记事本++ )

    确保将其保存为 UTF8型 .

        2
  •  0
  •   Lennart    6 年前

    我认为您需要做的是对html实体进行编码。

    https://docs.microsoft.com/en-us/dotnet/api/system.web.httputility.htmlencode