Skip to main content
Inspiring
March 30, 2012
Answered

How To Insert Special Characters

  • March 30, 2012
  • 1 reply
  • 3112 views

Hey,

I can't figure out how to insert special characters into a paragraph (the "Indent to Here" in this case).

I tried text_frame.paragraphs[0].contents +=  SpecialCharacters.INDENT_HERE_TAB;  but all I get is "1397319796" instead of the actual character.

How to insert special characters instead of those numbers?

This topic has been closed for replies.
Correct answer Jongware

Zoffix222 wrote:

People viewing but no one know this one?

What, you mean that in the 5 minutes since you posted it no-one answered? Shocking indeed.

As you aleady found out by yourself, "contents" is the wrong type of object to stuff "SpecialCharacters" in. "contents" is the contents of text, translated into a plain Javascript string. Only when you change a single 'character', you can use "SpecialCharacters", because at that point Extendscript will see you don't want to change the "entire" string?

1 reply

Zoffix222Author
Inspiring
March 30, 2012

People viewing but no one know this one?

Only with Adobe's creation could you have a full language manual and a forum, and still have no clue how to do the simplests of things...

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
March 30, 2012

Zoffix222 wrote:

People viewing but no one know this one?

What, you mean that in the 5 minutes since you posted it no-one answered? Shocking indeed.

As you aleady found out by yourself, "contents" is the wrong type of object to stuff "SpecialCharacters" in. "contents" is the contents of text, translated into a plain Javascript string. Only when you change a single 'character', you can use "SpecialCharacters", because at that point Extendscript will see you don't want to change the "entire" string?

Jongware
Community Expert
Community Expert
March 30, 2012
What, you mean that in the 5 minutes since you posted it no-one answered? Shocking indeed.

No, that 50 people who were curious enough to read the message didn't know the answer. And that language reference doesn't provide a single shred of info on how to use those special characters. That's what's shocking.

As you aleady found out by yourself, "contents" is the wrong type of object to stuff "SpecialCharacters" in. "contents" is the contents of text, translated into a plain Javascript string. Only when you change a single 'character', you can use "SpecialCharacters", because at that point Extendscript will see you don't want to change the "entire" string?

Thanks. What I found is that if I use assignment, instead of +=, then the special character is added without replacing the string.


Zoffix222 wrote:

Thanks. What I found is that if I use assignment, instead of +=, then the special character is added without replacing the string.

Ah, yes, that was the term I was looking for. With your "contents += ..", the entire contents are 'read', converted into a Javascript string, and at that point you cannot insert the SpecialCharacters anymore. With a straight assignment, one at a time, it works.

The biggest downside of this method is that you can only add one special character at a time. I guess that's just the price you have to pay for this method, working around Unicode. You'll also have the same problem if you try to read a contents string back that contains any special character ...