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

Text from CSV - Hyphens preventing textItem writing to layer

Participant ,
Apr 23, 2022 Apr 23, 2022

Hi,

It seems that when I read the data from a csv file and try to write it to a text layer It breaks when there are hyphens in the string. Nothing is written. The ASCII characters do not apperear to cause an issue.

Here is how I'm writing the data to the layers. Layer set with text layer. col_A is the vatiable that contains the data from the .csv file.

  app.activeDocument.layers.getByName( "Column A Layer" ).layers.getByName('col_A text').textItem.contents = col_A ;

This does not work:

588-719-163-879-þ80

1-512-29-1286-5

 

This works:
90536601
944023

235 Y44 546 þ432

7245 7090


Using Photoshop 2021 on MAC OS X (Mojave)

Thanks!
Screen Shot 2022-04-23 at 2.07.45 AM.png

TOPICS
Actions and scripting , macOS
730
Translate
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

correct answers 1 Correct answer

LEGEND , Apr 23, 2022 Apr 23, 2022

Perhaps you don't have .csv correct coding, like UTF-8?

Translate
Adobe
Community Expert ,
Apr 23, 2022 Apr 23, 2022

I'm getting hyphens OK, however, I'm just getting a funky \r - \n linefeed character:

 

test.png

 

I haven't worked with a lot of text reads, so I'm sorry that I can't help any further.

 

Have you tried using code for the hyphens rather than the literal character?

Translate
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
Participant ,
Apr 23, 2022 Apr 23, 2022

Thanks Stephen, No I didn't try using code. It would have to change the hyphens to code after it reads from the csv file and before writing if that's the answer. I have to look deeper at why the hyphens are stopping the text writing for me.

Translate
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
LEGEND ,
Apr 23, 2022 Apr 23, 2022

Perhaps you don't have .csv correct coding, like UTF-8?

Translate
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 ,
Apr 23, 2022 Apr 23, 2022

Good point, I tested both UTF-8 and UTF-16 encoding and all three linefeed options.

Translate
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
LEGEND ,
Apr 24, 2022 Apr 24, 2022

There is ASCII as well and many other encodings which could be used.

Translate
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
Participant ,
Apr 26, 2022 Apr 26, 2022
LATEST

I'm now using CSV UTF-8 (Comma delimited) (.csv) and it's working.

Translate
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