Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

HtmlLocalizer and ViewLocalizer mishandle arguments; pass IHtmlContent values to HTML encoder #3659

@dougbu

Description

@dougbu

MVC has moved away from bogus ToString overrides but the HtmlLocalizer implementation has not reacted to this change. The result is twofold:

  • Many IHtmlContent values display their type names when used as IHtmlLocalizer.Html() or IViewLocalizer.Html() arguments. For example this occurs with view component results e.g. @Localizer.Html("Hello {0}!", Component.Invoke("CurrentUser")).
  • Arguments that are already HTML encoded and avoid the above issue are double-encoded. This occurs with HtmlString values passed as arguments to IHtmlLocalizer.Html() or IViewLocalizer.Html() e.g. @Localizer.Html("Not that {0}!", new HtmlString("<input>")).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions