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 É.
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 functions:
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 the characters from languages other than English.
Version Info:
CEP: 9
Illustrator: 26.1 (2022)
OS: Windows 10