Click here to Skip to main content
13,051,413 members (51,437 online)
Rate this:
Please Sign up or sign in to 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 1-Feb-13 4:16am
Niral Soni 1-Feb-13 10:33am
try encoding the data using escape() or encodeURIComponent()
ryanb31 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.
ryanb31 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100