Click here to Skip to main content
11,712,466 members (73,128 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript Arabic
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 at 1-Feb-13 10:33am
try encoding the data using escape() or encodeURIComponent()
ryanb31 at 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 at 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 at 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
0 CHill60 335
1 Sergey Alexandrovich Kryukov 284
2 OriginalGriff 230
3 Andy Lanng 160
4 Maciej Los 130
0 CHill60 335
1 Sergey Alexandrovich Kryukov 280
2 OriginalGriff 230
3 Andy Lanng 160
4 Maciej Los 130

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2015
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