• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

getSystemPath using CSInterface throws URI Malformed error

New Here ,
Apr 12, 2023 Apr 12, 2023

Copy link to clipboard

Copied

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.

 

Sanjay_Palanisamy_0-1681305297848.pngSanjay_Palanisamy_1-1681305313719.png

 

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

TOPICS
SDK

Views

193

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Adobe