Copy link to clipboard
Copied
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!
Perhaps you don't have .csv correct coding, like UTF-8?
Copy link to clipboard
Copied
I'm getting hyphens OK, however, I'm just getting a funky \r - \n linefeed character:
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Perhaps you don't have .csv correct coding, like UTF-8?
Copy link to clipboard
Copied
Good point, I tested both UTF-8 and UTF-16 encoding and all three linefeed options.
Copy link to clipboard
Copied
There is ASCII as well and many other encodings which could be used.
Copy link to clipboard
Copied
I'm now using CSV UTF-8 (Comma delimited) (.csv) and it's working.