[GIS] Query task issue with Arabic input

arabicarcgis-javascript-apiinternationalization

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 : )

@All

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

Best Answer

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 : )