Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I am developing a web application (In Marathi Language) in which i used a asp:label and in that label i want to display some content which is in Marathi language.

As am storing the content in database in English language and when i load data from database and insert into asp:label it converts the post content of "<" symbol as html tag. So it renders only half of the text part.

Please see the following code where in my asp:label i have assigned a marathi text to it. But it renders the part upto "<e"> symbol
<asp:Label ID ="lblpbkTest" runat="server" class="headerLblColor" Text="efJeMes<ekeÀe³e&keÀejer DeefOekeÀejer"></asp:Label>


and when i remove OR insert a space between "<" and "e" it renders the content properly

C#
<asp:Label ID ="lblpbkTest" runat="server" class="headerLblColor" Text="efJeMes< ekeÀe³e&keÀejer DeefOekeÀejer"></asp:Label>


but giving a space or removing "<" change the meaning of the content(context).

Can anybody help me to resolve this issue.

Thanks in advance :-)
Shailesh J.
Posted

1 solution

This is security in .net to prevent malicious code.

Have you set the region specific web settings properly?

If so try this:

C#
string teststring = "efJeMes<ekeÀe³e&keÀejer DeefOekeÀejer";
            using (Label testlabel = new Label())
            {
                testlabel.Text = Server.HtmlEncode(teststring);
                Controls.Add(testlabel);
            }
 
Share this answer
 
Comments
saj_21 6-Nov-12 7:25am    
Thanks onenomi. It works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900