Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor dynamic meta tag encoding issue

$
0
0

EDITED: I do have <meta charset="UTF-8"> in my MainLayour.razor.

Using Blazor on .NET 9.0, I have the following in my MainLayout.razor

<meta name="title" content="@this.MetaTitle">

and in the MainLayour.razor.cs, I set the MetaTitle like this:

this.MetaTitle = this.WebsiteTitle +" - " + sBreadcrumbTitle;

(this.WebsiteTitle = 'AMS'& sBreadcrumbTitle = 'test')

All is ok until I have a mixed English language with none English coming from sBreadcrumbTitle like:

(this.WebsiteTitle = 'AMS'& sBreadcrumbTitle = 'แขก')

The MetaTitle becomes something like AMS - &#xE41;&#xE02;&#xE01;.

In MainLayout.razor, I have the following:

<meta name="title" content="@this.MetaTitle"><meta property="og:title" content="@this.MetaTitle" />

The og:title is exactly the same variable but for some reason the<meta name="title" ends up with AMS - &#xE41;&#xE02;&#xE01;whereas <meta property=\"og:title\" is correct as `AMS - แขก'

This is also the same issue for meta name="description". Do I need to encode or decode something?

Any info would greatly be appreciated.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>