Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a database that contains fields containing Unicode Arabic characters that I convert into JSon to displayed in a table by javascript.
I checked with fiddler and all is correct, however the javascript does not seem to understand Arabic characters as it displays undefined in the place of the Arabic characters.
Posted
Comments
Niral Soni 1-Feb-13 10:33am    
try encoding the data using escape() or encodeURIComponent()
ZurdoDev 1-Feb-13 10:56am    
Displaying undefined usually will mean a variable or control is undefined. post the code that is having the issue so we can see.
Member 8442750 1-Feb-13 11:13am    
the process is as follows:
- I am using MVC razor
- in the controller I get the records from a database, build a collection and send it to the view.
- in the view I convert the model to json as follows: Dim TA = Html.Raw(Json.Encode(Model)).
- then I send the data to a javascript that reads this data and displays it on the page.
what is worth noting:
- English characters and numbers are being displayed normally
- Arabic fields display as undefined only.
so my problem is actually with the fields that contain Arabic characters, as it seems javascript cannot determine their type (probably) so it cannot treat them as strings to display.
ZurdoDev 1-Feb-13 11:23am    
In my experience JS doesn't care that much. Undefined is a key word in javascript. Have you put breakpoints in the various places to check and see what is getting sent. It's just a hunch, but I think your issue may actually be in the server side code.

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