arcgis-python-api
arcgis-python-api copied to clipboard
Diacritics in an ArcGIS Survey 123 Form result in a failure during cloning
Describe the bug During clone_items() of an ArcGIS Survey123 Form, if a question has any diacritics like macrons (e.g. the ā in Māori) cloning fails.
To Reproduce Steps to reproduce the behavior:
Publish a Survey to ArcGIS Portal, with a question containing diacritics. Clone the Form using the normal ArcGIS Python API workflow.
error:
_ItemCreateException: ("Failed to create Form X: Failed to updateX: 'charmap' codec can't decode byte 0x81 in position 18347: character maps to
Expected behavior The Form should clone.
NOTE: If I monkey patch the ArcGIS Python API as follows, cloning works as expected. ..\site-packages\arcgis\_impl\common_clone.py#L5279 elif path.lower() == "form.json": with open(os.path.join(zip_dir, path), "r", encoding="utf8") as file: form_json = file.read()
Platform (please complete the following information):
- OS: Windows
- Browser: NA
- Python API Version: 2.2.0.1
Additional context None at this time
@nparavicini7. FYI, at ArcGIS Python API 2.3.0 a similar issue now occurs at line common_clone.py#L5313: with open(os.path.join(zip_dir, path), "w") as file: need to be changed to with open(os.path.join(zip_dir, path), "w", encoding="utf8") as file: to get diacritics to work