Click here to Skip to main content
15,921,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have a web application using c# asp.net. when entering arabic names or characters it save them as ???? ??????.

any idea. i change most of fonts for the text box but no success.

thanks in advance

ahmad zrin
Posted
Comments
Amir Mahfoozi 19-Nov-11 14:37pm    
What is the field data type ? if it is nvarchar you will not face any problem.
ahmad zrein 19-Nov-11 21:59pm    
yes it is nvarchar

1 solution

It's nothing to do with fonts, the character encoding is going wrong somewhere. The first step is to ensure your Arabic text fields use the correct collation. A pretty good introduction can be found here SQL Server and Arabic Language[^]. You should perform a test inserts directly into the db.
I don't think this will fix *existing* records, but I could well be wrong, my test rig at home won't let me try this easily. Hopefully I am wrong about this.

The other problem you might be having is that your server is interpreting the Arabic in the http request as one of the European encodings. This is less likely, but if you set the default request encoding to utf8, you should be OK.
You only need to check the request encoding if collation thing on the database fails.
 
Share this answer
 
Comments
ahmad zrein 19-Nov-11 12:51pm    
yes when insert data directly into the sql database it take arabic correctly. but when i use insert ... Values in c# it save ????

thanks in advance
Keith Barrow 19-Nov-11 15:56pm    
Can you clarify the difference between inserting directly and using insert please? In any case, in your position I'd put a breakpoint in your project and check that the text you are trying to insert is coming through as Arabic, just to check the request encoding.
RaviRanjanKr 19-Nov-11 14:56pm    
Nice Answer, My 5+
ahmad zrein 19-Nov-11 21:57pm    
i mean when open the database from sql design and enter arabic character it takes. while entering data from the program it give ???
Keith Barrow 20-Nov-11 2:51am    
You should also try using an INSERT from a TSQL statement, though this should be the same as entering directly IIRC.
As I said, it sounds like the character encoding is changing in the ASP.NET code, you'll need to step through that to determine whether it arrives as Arabic and if it does, where the encoding is changed.

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