Copy link to clipboard
Copied
Hi All,
In Photoshop scripting, the filename with special characters(<>,[], -) is broken and able to save the file using scripting, I tried with the encodeURI method, and it works but the original fileName with special characters has converted into encoded value.
for ex: original filename is "For PLUS+SP – 2.jpg" its broken like "For PLUS+SP †2" not able to save the file.
if converted into an encoding method, it can save names like
"For %20PLUS+SP%20%13%E2%80%A02.tif" if i decoded it will come like broken "For PLUS+SP †2".
i want to save the file with original filename using script without broken and also handle if any special characters in the filename. is it acheivable?
Copy link to clipboard
Copied
Filenames are restricted by Windows, not applications.
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Name the files in a way that won't cause errors.
Jane
Copy link to clipboard
Copied
It's not very clear what's wrong with you.
Why are you using encodeURI and decodeURI?
And how did you get from "For PLUS+SP – 2.jpg"
this: "For %20PLUS+SP%20%13%E2%80%A02.tif" ?
I get "For%20PLUS+SP%20%E2%80%93%202.jpg".
And it decodes back without problems.
If you use characters from UTF8 in a script, then in order for Photoshop to correctly understand that this is UTF8, your file must contain a BOM mark at the beginning to work correctly with these characters.
About BOM read this topic https://community.adobe.com/t5/photoshop-ecosystem-discussions/charset-of-textitem/m-p/9966206