Skip to main content
Known Participant
November 2, 2010
Question

CS5:JS:Extended ASCII Chars in File-path. How?

  • November 2, 2010
  • 1 reply
  • 1375 views

Hi all,

I have a script for setting the content of image frame like :

anXMLElement.setContent(File("/Users/MyName/Desktop//MyFileNameWithö.jpg"));

if the file name contains extended char like "ö" by running the above script I'll get exception says" file cannot import or doesn't exist in the path"

Can someone help me how to handle the path for this case?

P.S I pass the fullpath to the piece of script that was calculated in GUI, in above script i directly used the path to show how it looks like when executed.

I used "\" in front of those special chars, but didn't help

Thanks,

Kamran

This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
November 2, 2010

Use this:

File (encodeURI ("/Users/MyName/Desktop//MyFileNameWithö.jpg"));

which replaces the non-ASCII characters with their hex value.

Peter

Kamrun_Author
Known Participant
November 2, 2010

Hello Peter,

Tried it, but it didn't help at all. It complains same thing thru exception "The file specified by the href attribute cannot be found or is not importable"

Any idea?

Thanks again,

KAmran

Peter Kahrel
Community Expert
Community Expert
November 2, 2010

What do you get when you try this:

(File (encodeURI ("/Users/MyName/Desktop//MyFileNameWithö.jpg"))).exists;

true or false?