getSystemPath using CSInterface throws URI Malformed error
I was trying to get the my documents folder path of the system using CSInterface getSystemPath function. It works in most of the cases. But it throws URI malformed error (refer the screenshot below), if the path of the documents folder contain characters from languages other than English.
I debugged the CSInterface.js file at line 521. And I found that the below piece of code returns the path of the folder without encoding the characters from languages other than English.
window.adobe_cep.getSystemPath(pathType)
IN MY CASE:
Path of documents folder: "C:\Users\sanjay\OneDrive - Élégante\Documents".
window.adobe_cep.getSystemPath(pathType)
// Returned value - "file:///C:/Users/sanjay/OneDrive%20-%20Ã%89lÃ%a9gante/Documents"
// É is encoded as Ã%89
encodeURI("C:/Users/sanjay/OneDrive - Élégante/Documents")
// Expected value - "file:///C:/Users/sanjay/OneDrive%20-%20%C3%89l%C3%A9gante/Documents"
// É is encoded as %C3%89
decodeURI("Ã%89") throws URI malformed error.
decodeURI("%C3%89") returns É.
ISSUE:
So, I guess it is the problem with the encoding of window.adobe_cep.getSystemPath(pathType). Is there any work around for this issue?
SAME ISSUE WITH OTHER FUNCTION:
I'm also facing the same issue with other scripting functions like "documentAfterActivate" CS Event which returns the path of active document if a document is opened. The path received is not encoded properly for characters other than English.
VERSION INFO:
CEP: 9
InDesign: 2022
OS: Windows 10