Skip to content

[.NET HTML][Globalization] Renderer produces invalid HTML in some cultures #3656

@mikoskinen

Description

@mikoskinen

Platform

  • .NET HTML

Author or host

Custom Host using AdaptiveCards.Rendering.Html.

Version of SDK

AdaptiveCards.Rendering.Html version 1.2.4 from Nuget. Same issue in master branch.

Details

AdaptiveCardRenderer doesn't take into account the system's culture when a card is rendered. Because of this, the rendered cards have invalid HTML for line-height and for colors.

Example output from a computer running fi-fi -culture:

<div class='ac-adaptivecard' style='width: 100%;background-color: rgba(255, 255, 255, 1,00); padding: 15px;box-sizing: border-box;justify-content: flex-start;'>
	<div class='ac-textblock' style='box-sizing: border-box;text-align: left;color: rgba(0, 0, 0, 1,00);line-height: 18,62px;font-size: 14px;font-weight: 400;white-space: nowrap;'>
		<p style='margin-top: 0px;margin-bottom: 0px;width: 100%;text-overflow: ellipsis;overflow: hidden;'>Adaptive Cards for Blazor simple example</p>
	</div>
</div>

As you can see, the background-color's opacity and line-height both contain a comma instead of a dot.

This is because in the code the culture isn't provided so the system's culture is used:

.Style("line-height", $"{lineHeight.ToString("F")}px")

I'll submit a PR for this which makes sure that Invariant Culture is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions