Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using ArcGIS Java Script API version 2.8 & using query layer in ArcGIS server.

The data is coming from sql server and most of the data is in Arabic. I am sorting the data according to the particular map is displaying.

I have created the query task and the result will be displayed in a combo-box but when I select Arabic record, the map is displaying blank. If I select English record then its displaying correctly. For details please check the screenshot.

The column type is nvarchar in sql server and in query task, I am using the where condition as follows but still getting an error:

query.where = "STATE <> N''"  (In sql server query works if I use N'<Arabic text>') 

What I tried:

  1. Changed the query parameter.
  2. It works perfectly for English names.
  3. Added UTF 8 encoding.
  4. Upgraded API to 3.2 (latest one)
  5. In Sql server where query works successfully.

Still getting an error. Any help will be great!!! thanks in advance : )


I confirmed through REST API and through API that I was able to query to the database. Please check the new screenshots

So as far as the logic, the information is coming but its not displaying on the map (its interesting), also I have checked parameters in the map service and still researching.

enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

share|improve this question
Def an encoding an issue. Focus on the error. What REQUEST/RESPONSE is being fired when you choose Arabic. (use Fiddler/Firebug). Also try to execute the query directly against the REST services directory to see if you can replicate. Might need to pass in a unicode object? Edit ur answer with these findings. – Simon Dec 24 '12 at 13:18
@ Simon thanks for your reply..I will check the parameters and let you know. Thanks for the quick response : ) – Sunil Dec 24 '12 at 13:56
up vote 3 down vote accepted

I was able to find the answer and thanks a lot Simon for your important points/guidelines.

I have attached JS fiddle with this and I have changed the following things:

  1. In query task I used: query.where = "1=1";
  2. On line no 275 I have inserted "N" for varchar data type and it works successfully!!

    layerDefs[0] = "STATE   = " + "**N**'" + selItem.value + "'";
  3. The complete JS Fiddle is here ( Only I have changed the server name)

Thanks again to Simon : )

share|improve this answer
no probs. Thanks for sharing how u solved it. Pls mark this answer as the one that solves the Q. (green tick to the left) – Simon Dec 26 '12 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.