Skip to main content
AYS__HAKKIM
Inspiring
February 8, 2010
Answered

How to get unicode value of a selected char?

  • February 8, 2010
  • 4 replies
  • 1502 views

Hi All

How to get unicode value of a selected char?

This topic has been closed for replies.
Correct answer Jongware

The contents property of an InDesign object "Character" is a plain Unicode string. Accessing the individual characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

Therefore, the unicode value of a selected char is

app.selection[0].characters[0].contents.charCodeAt(0)

4 replies

AYS__HAKKIM
Inspiring
February 9, 2010

Many thanks to all

ramkumar_vp
Inspiring
February 9, 2010

Hi Hakkim,


It is very easy.Select the character & execute the below code:


For special characters: app.selection[0].contents;


For normal characters: app.selection[0].contents.charCodeAt(0);


Regards,

Ramkumar .P

Robert at ID-Tasker
Brainiac
February 8, 2010

AYS. HAKKIM wrote:

How to get unicode value of a selected char?

You will get answer quicker  - if you specify in which language you need help - JS, AS or VB?

robin

www.adobescripts.com

Jongware
JongwareCorrect answer
Community Expert
February 8, 2010

The contents property of an InDesign object "Character" is a plain Unicode string. Accessing the individual characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

Therefore, the unicode value of a selected char is

app.selection[0].characters[0].contents.charCodeAt(0)