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

Special Characters string not working?

Guest
Oct 04, 2010 Oct 04, 2010

Hello,

Using Javascript/CS5, I'm trying to put a string of special characters into a text frame using the "SpecialCharacters.TRADEMARK_SYMBOL" syntax. It works, but only if I use one special charaters. Doing this:

myTextFrame.insertionPoints[-1].contents = SpecialCharacters.BULLET_CHARACTER + '  ' + SpecialCharacters.TRADEMARK_SYMBOL;

Gives me this result in the text frame, it uses the numeric value now: 1396862068  1398041963

I'm wondering how I could put several special characters together in a text frame but actually get the symbols to show up?

Thanks!

TOPICS
Scripting
915
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

Participant , Oct 04, 2010 Oct 04, 2010

Search for unicode value for the characters, and make a new string using String.fromCharCode function:

     prefixString+String.fromCharCode(0xC7,0xC9...)+sufixString;

Regards

Translate
LEGEND ,
Oct 04, 2010 Oct 04, 2010

You can't string together special characters because it converts them to strings instead of SpecialCharacters.

You can either use the unicode values (if that's an option), or insert them separately.

Harbs

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
Guest
Oct 04, 2010 Oct 04, 2010

cool, I will just add them separately. But what about symbols for 1/2 and 1/4? I don't see a SpecialCharacters option for those?

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 ,
Oct 04, 2010 Oct 04, 2010

Search for unicode value for the characters, and make a new string using String.fromCharCode function:

     prefixString+String.fromCharCode(0xC7,0xC9...)+sufixString;

Regards

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
Guest
Oct 04, 2010 Oct 04, 2010

awesome, thanks for the help guys. That works perfectly!

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 ,
Oct 04, 2010 Oct 04, 2010
LATEST

If you know the unicode value, there's no need to use functions. Simple unicode notation works fine:

(i.e.  "\u00BD" + " is a one-half symbol")

Harbs

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