Rooh Al-mahaba
Rooh Al-mahaba

Reputation: 674

how to make the data in gridview display in arabic letters using asp.net c#

enter image description here

When I enter the data in textbox and then click a button it should insert it in the gridview but the arabic letters shown as "??????????" like shown in the picture, I searched and found that the problem in the encoding but the problem with me is not in the web page because the web page show the arabic letters correctly , the problem in the gridview

I also try this code but its not work:

Response.Write("<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />");

Upvotes: 0

Views: 1973

Answers (2)

Shamal Sabah
Shamal Sabah

Reputation: 239

Just add this CharSet=UTF8 to the connection string in the settings of the App Project.

Upvotes: 0

Neeraj
Neeraj

Reputation: 4489

Hey You have to make sure that the content encoding for your web pages is UTF, otherwise it is not going to work. Here are few tips:

  1. Make sure the datatype of your data in database table is nvarchar.
  2. Make sure that the SP you are using also has nvarchar as parameter type.
  3. Make request and response encoding as UTF-8. Add this in the web.config for application level encoding:

    <configuration>
     <system.web>
      <globalization
        requestEncoding="utf-8"
        responseEncoding="utf-8"/>      
    
     </system.web>
    

and add this for page level encoding:

<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>

Hope it helps you

Upvotes: 1

Related Questions