I have ASP.NET MVC 3 application having resource files in english and french. A text 'Sélectionner la pharmacie' is stored in a french resource file.
When the value is read from resource files with razor syntax, it shows 'S#233;lectionner la pharmacie' instead of 'Sélectionner la pharmacie'.
e.g.
@MyResources.Strings_Resources.lbl_SelectPharmacy
Is there a way I can make it show the french accent characters ?
First check your master page, you have set UTF-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<system.web>
<globalization enableclientbasedculture="true" uiculture="auto" culture="auto">
<!-- Use above or below <globalization> line, based on your site -->
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>
If you have set this already then try below setup:-
<asp:Label Text="<%$ Resources:Strings, MyGlobalResource %>" runat="server" />
<asp:Label Text="<%$ Resources:MyLocalResource %>" runat="server" />
<%= HttpContext.Current.GetLocalResourceString("~/YOURASPXPAGE", "MyLocalResource", CultureInfo.CurrentUICulture) %>
Refer this URL for more info:-
I suspect that your text is already encoded and razor is trying to encode it again (it encodes all outputs)
Try with
@Html.Raw(MyResources.Strings_Resources.lbl_SelectPharmacy)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With