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

filename with special characters is broken

Contributor ,
Dec 08, 2023 Dec 08, 2023

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?



TOPICS
Actions and scripting , SDK , Windows

Views

93

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
Adobe
Community Expert ,
Dec 10, 2023 Dec 10, 2023

Copy link to clipboard

Copied

Rocky@ 

 

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

 

Votes

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
People's Champ ,
Dec 10, 2023 Dec 10, 2023

Copy link to clipboard

Copied

LATEST

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

 

 

Votes

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