Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Unicode variables in expressions

  • Unicode variables in expressions

    Posted by Thomas Hannen on January 24, 2012 at 1:04 pm

    Hi,

    I’m trying to find a way to count up some numbers using Persian or Arabic numerals. I’m using After Effects CS5.5 on a Mac OS 10.6

    For example, the numbers 01234 in English are ۰۱۲۳۴ in Persian.

    I’d like to be able to control the value displayed via a slider on a text layer.

    Initially I set it up like this in English:

    myArray = ['0','1','2','3','4'];
    myvalue = Math.round(effect("Slider Control")("Slider"));
    text.sourceText = myArray[myvalue];

    This works fine. But when I try to change it to something like this:

    myArray = ['۰','۱','۲','۳','۴'];
    myvalue = Math.round(effect("Slider Control")("Slider"));
    text.sourceText = myArray[myvalue];

    The unicode characters get destroyed, and I end up with this:

    myArray = ['?','?','?','?','?'];
    myvalue = Math.round(effect("Slider Control")("Slider"));
    text.sourceText = myArray[myvalue];

    Is there a way of explicitly stating the unicode values in expressions? I believe the correct values are:

    U+0660
    U+0661
    U+0662
    U+0663
    U+0664

    Thanks in advance!

    Tom

    Thomas Hannen replied 14 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    January 24, 2012 at 3:43 pm

    try this:
    myArray = ['\u0660', '\u0661', '\u0662','\u0663','\u0664'];
    myvalue = Math.floor(effect("Slider Control")("Slider"));
    text.sourceText = myArray[myvalue];

    i also found this unicode-to-java converter that may be useful to you:
    https://www.snible.org/java2/uni2java.html

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Thomas Hannen

    January 24, 2012 at 4:24 pm

    Hi Kevin,

    Thanks for that.. Did that work when you tried it?

    I entered the script as you suggested, but After Effects converts the arabic numbers into english (see video below).

    And yet, if I type the numerals directly into After Effects (using the Persian input method), they render correctly.

    If I go to the unicode web page you suggested, and enter the number, it confirms that I’m using the right unicode numbers.

    So I guess it’s an AE bug?

    I’ve tried to embed a video showing the problem, and there’s also a version on Vimeo here:
    https://vimeo.com/35577474
    https://reels.creativecow.net/film/weird-unicode-persian-after-effects-bug

  • Kevin Camp

    January 24, 2012 at 5:21 pm

    sorry, i wasn’t understanding how you were inputting the persian characters…

    i’m not sure if it is a bug with ae or the way java expressions handle unicode vs. the way the apple creates the text with it’s international input menu… my guess that ae’s java expressions use a smaller unicode set.

    but you can create a work around by creating a comp with a layer for each character that are all just one frame long and then sequence them… so you’d have a 10 frame long comp with 10 layers, one for each persian number. the frame size for the comp can be any size, but you might make it about the same size as you need it in the final comp.

    then drop that persian number comp into a new (or final) comp, add an expression slider control, enable time remapping and use an expression like this to drive the character change.
    f = Math.floor(effect("Slider Control")("Slider"));
    framesToTime(f)

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Thomas Hannen

    January 24, 2012 at 5:30 pm

    Hi Kevin,

    Yes, sounds like it would solve it for this… Hopefully Adobe will address it eventually!

    Thanks for your time,

    Tom

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy