Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC 3 jquery : French accent characters are showing as #233 characters on screen

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 ?

like image 528
user1053426 Avatar asked Nov 18 '11 09:11

user1053426


2 Answers

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:-

  1. ASP.NET MVC 3 Internationalization
  2. ASP.NET MVC - Localization Helpers
like image 161
Siva Charan Avatar answered Nov 17 '22 06:11

Siva Charan


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)
like image 25
Eduardo Molteni Avatar answered Nov 17 '22 05:11

Eduardo Molteni