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

How to make the script support Chinese, Japanese and other languages when getting ink.name?

Contributor ,
Nov 20, 2023 Nov 20, 2023

Copy link to clipboard

Copied

The illustrator script cannot support Chinese, Japanese and other languages when getting ink.name, and it displays garbled characters.

Seeking guidance and assistance from the community's experts. Thank you, everyone!

 

 

  var doc = app.activeDocument;
  var inkList = doc.inkList;
  var inkUsage = [];


  for (var i = 0; i < inkList.length; i++) {
    var ink = inkList[i];
      var inkName = ink.name;
      inkUsage.push(inkName);
      }

    alert(inkUsage.join("\n"));
    $.write(inkUsage.join("\n"));

 

 

 

error.jpg

TOPICS
Scripting

Views

407

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
Enthusiast ,
Nov 20, 2023 Nov 20, 2023

Copy link to clipboard

Copied

This may be useless, but try the string 

var inkName = decodeURIComponent(ink.name);

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
Contributor ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

@Sergey Osokin 

I have tried doing it myself, but I still got the same result which is garbled characters.

I suspect that ink.name does not support non-English language environments.

However, I still appreciate your response!

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
Community Expert ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

Hi @Aprking, it might be worth posting a demo file showing example ink names. So people can look into it further.

- Mark

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
Contributor ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

@m1bThe information output by the above JSX script appears as garbled characters in versions of Illustrator running in Chinese, Japanese, and other non-English languages. Currently, I am not aware if the information output is abnormal in all other non-English language versions of Illustrator.

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
Enthusiast ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

I have checked the Cyrillic version of the interface. I confirm that inkList returns encoded names. I cannot yet determine which encoding is used.

 

[Ink Òðèàäíûé Ãîëóáîé],[Ink Òðèàäíûé Ïóðïóðíûé],[Ink Òðèàäíûé Æåëòûé],[Ink Òðèàäíûé ×åðíûé]

It should stand for

[Ink Триадный Голубой],[Ink Триадный Пурпурный],[Ink Триадный Желтый],[Ink Триадный Черный]

 

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
Contributor ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

Even when running this script in the English version of Illustrator to retrieve ink.name, if the Spot Color name is in Chinese, Japanese or any non-English language, it cannot display the true spot color name correctly. Instead, it shows as Global Color, Global Color1... Therefore, I have tried various encoding and decoding methods, but I still cannot obtain the correct names for CMYK and Spot Colors.

spotname.jpg

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
Enthusiast ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

I also confirm this problem in different AI versions.

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
Contributor ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

I would like to obtain information about the ink names currently used in the document. Besides 'ink.name,' I'm not sure if there are any other methods. Can you provide more insights?

Thank you for your reply!

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
Enthusiast ,
Nov 21, 2023 Nov 21, 2023

Copy link to clipboard

Copied

I was wondering what is stored in the XMP of the document data. And as we can see on the screenshot, blue and orange plates with non-English names are also not added to the xmpTPg:PlateNames property. Read the Adobe XMP Specification about xmpTPg:PlateNames: "An ordered array of plate names that are needed to print the document (including any in contained documents)".

 

I don't associate this with the scripted inkList attribute. But I find that the problem is broader than scripts

xmpdata.jpg

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
Enthusiast ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

And here are the unnamed Global Color swatches when you open the .ai file with a code editor

 

[/Separation/Custom#20Green/DeviceCMYK<</C0[0.0 0.0 0.0 0.0]/C1[0.77 0.01 0.85 0.0]/Domain[0 1]/FunctionType 2/N 1.0/Range[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]>>]

[/Separation/Global#20Color/DeviceCMYK<</C0[0.0 0.0 0.0 0.0]/C1[1.0 0.01 0.0 0.17]/Domain[0 1]/FunctionType 2/N 1.0/Range[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]>>]

[/Separation/Global#20Color#202/DeviceCMYK<</C0[0.0 0.0 0.0 0.0]/C1[0.06 0.32 1.0 0.04]/Domain[0 1]/FunctionType 2/N 1.0/Range[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]>>]

 

And here are those swatch names in some Unicode encoding in DocumentCustomColors, which we also get in inkList

 

%%DocumentCustomColors: (Custom Green)
%%+ (Синий)
%%+ (オレンジ)

 

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
Contributor ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

My friend, you are truly dedicated, and I am extremely grateful for your assistance. I have considered using Global Colors and their corresponding Spot Colors in the Swatches panel to obtain the correct Spot Color names.

However, I have discovered that if Spot Colors are deleted or new ones are added during the process, the Global Color names will increment as Global Color i+1. This makes it impossible to establish a complete correspondence between Spot Colors and Global Colors. Furthermore, when iterating through the Spot Color names in the Swatches panel, they are not sorted by creation time but rather by the Spot Color's name, rendering this method ineffective.

Well, it seems that resolving this issue is indeed impossible. Nevertheless, I still appreciate your help, my friend.

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
Engaged ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

LATEST

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