SEO title and description encoding problem (REOPEN)

1 周 前
Hello, I face exact problem mentioned in this topic, however I see that there are no solution found.
https://www.nopcommerce.com/en/boards/topic/51086/seo-title-and-description-encoding-problem
Does anyone solved this case?
I enabled this ->
"Convert non-western chars" under Settings -> General Settings -> SEO.
1 周 前
The option "Convert non-western chars" under Settings -> General Settings -> SEO, only applies to the URL slug.  The Title is always HTML encoded.
(And, the setting must be in effect before you add a new product, because the generation of the URL slug happens then.  If you change the setting, then prior added products won't be affected.  You'll need to edit the product, blank out the "Search engine friendly page name", and then Save the product.)

I did a little debugging.  The problem is that the <title> element's value is always Encoded...

Since the page’s encoding seems to be properly set to UTF-8, non-western characters in the title should not be a problem, and should not need to be encoded.
In terms of encoding, I believe that it's only that the text inside the <title> tags should not contain less than (<) or greater than (>) signs, as these are used to denote the start and end of HTML tags.
I don't believe characters ampersand (&), double quote ("), and single quote (') would cause issues because the title text is within the tags (not attributes).

However, I don't see a quick fix for to handle the complete title which includes the store name as a prefix to product name - I.e.,
<title>Your store. Your Product Name</title>

\Presentation\Nop.Web\Views\Product\ProductTemplate.Simple.cshtml
//title
NopHtml.AddTitleParts(!string.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);

You can probably replace the above with just
<title>@Model.Name</title>

but the product name would not be localized / store-specific and would not include the store name prefix.

This is because the above AddTitleParts adds the raw name to an internal _titleParts collection, which ulimately is encoded later when the "headers" are rendered.
\Presentation\Nop.Web\Views\Shared\_Root.Head.cshtml
var title = await NopHtml.GenerateTitleAsync();


\Presentation\Nop.Web.Framework\UI\NopHtmlHelper.cs
public virtual async Task<IHtmlContent> GenerateTitleAsync(bool addDefaultTitle = true, string part = "")
{
...
    return new HtmlString(_htmlEncoder.Encode(result ?? string.Empty));
}