mohammad ghari
mohammad ghari

Reputation: 183

unicode in web pages in asp.net core

my problem in this question is with Persian characters : in my app , in browser , my messages and texts are display very well but in back of the Scene is not good , look at image: enter image description here

and back (in browser page source): enter image description here

there are this characters , and main problem is here :

enter image description here

in view.cshtml:

@foreach (var choice in question.QuestionChoices)
                                        {
                                            <div class="databox radius-bordered bg-lightgray">
                                                <div class="databox-right bg-blueberry">
                                                    <div class="databox-piechart">
                                                        <div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="50" data-animate="500" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)" style="width: 47px; height: 47px; line-height: 47px;">
                                                            <span class="white font-90">@choice.AnswerChoices.Count</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="databox-left">
                                                    <span class="databox-number blueberry"><a style="color: inherit">@choice.Text </a></span>
                                                    <div class="databox-text darkgray"></div>
                                                </div>
                                            </div>
                                        }

in top code look at : @choice.Text and result:

<div class="databox radius-bordered bg-lightgray">
                                                <div class="databox-right bg-blueberry">
                                                    <div class="databox-piechart">
                                                        <div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="50" data-animate="500" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)" style="width: 47px; height: 47px; line-height: 47px;">
                                                            <span class="white font-90">0</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="databox-left">
                                                    <span class="databox-number blueberry"><a style="color: inherit">&#x6AF;&#x632;&#x6CC;&#x646;&#x647; 1 </a></span>
                                                    <div class="databox-text darkgray"></div>
                                                </div>
                                            </div>
                                            <div class="databox radius-bordered bg-lightgray">
                                                <div class="databox-right bg-blueberry">
                                                    <div class="databox-piechart">
                                                        <div data-toggle="easypiechart" class="easyPieChart" data-barcolor="#fff" data-linecap="butt" data-percent="50" data-animate="500" data-linewidth="3" data-size="47" data-trackcolor="rgba(255,255,255,0.1)" style="width: 47px; height: 47px; line-height: 47px;">
                                                            <span class="white font-90">1</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="databox-left">
                                                    <span class="databox-number blueberry"><a style="color: inherit">&#x6AF;&#x632;&#x6CC;&#x646;&#x647;2 </a></span>
                                                    <div class="databox-text darkgray"></div>
                                                </div>
                                            </div>

now in top html rendered a (گزینه 2) as a code how i can fix this issue?

my code is in C# and Asp.net Core. tnx.

Upvotes: 1

Views: 1043

Answers (2)

mohammad ghari
mohammad ghari

Reputation: 183

 services.AddSingleton<HtmlEncoder>(
            HtmlEncoder.Create(allowedRanges: new[] { UnicodeRanges.BasicLatin,
                UnicodeRanges.Arabic }));

Upvotes: 1

Rosco
Rosco

Reputation: 2514

It looks like you are using a component called "easypiechart" which is not displaying the characters correctly. Is that right?

You must talk to the easypiechart programmers and find a way to fix the problem.

The problem does not seem to be with asp.net core.

Upvotes: 0

Related Questions