1

Using “calculate field” in python script fails to display Arabic characters correctly.

I have exported the modelbuilder to python script, but unfortunately the Arabic characters cannot by displayed correctly when the script is executed.

# Import arcpy module
import arcpy
# Set Geoprocessing environments
arcpy.env.scratchWorkspace = "D:\\Test.gdb"
arcpy.env.workspace = "D:\\Test.gdb"
# Local variables:
Buildings_POINTS = "D:\\U.gdb\\Buildings_POINTS"
# Process: Calculate Field
arcpy.CalculateField_management(Buildings_POINTS, "Ref_MOLG", "\"المخططات الهيكلياهلين المعلن للاعتراض\"", "PYTHON", "")

Now when I copy the script to python: enter image description here enter image description here

I believe that its a Unicode issue. how can I fix it.

1

I think you can change python encoding, you may look at link below.

https://stackoverflow.com/questions/2996475/what-character-encoding-should-i-use-for-a-web-page-containing-mostly-arabic-tex

https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding

  • Hi Ncelick and PolyGeo, There the problem still there. – Ahmad saleh Apr 28 '15 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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