Click here to Skip to main content
Rate this: bad
good
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 5:16am
Comments
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 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2014
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