web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unexpected length valu...
Power Automate
Suggested Answer

Unexpected length values on some emojis?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee
When calling the length method on a string, I noticed that it returns a length of 2 for the 🚀 rocket ship emoji. Is there a way to work around this without having to do complex character calculations to know which one will be length 2 or length 1?
Categories:
I have the same question (0)
  • Vish WR Profile Picture
    3,748 on at
     
     

    The length() function in Power Automate counts UTF-16 code units, not visible characters. Emoji like 🚀 sit outside the Basic Multilingual Plane and require two code units (a surrogate pair), so they return 2. This is expected behaviour, not a bug.

     

    There is no native workaround in Power Automate expressions today. The expression engine has no concept of grapheme clusters or visible character count.

     

    If you need to enforce character limits on inputs that may contain emoji, the cleanest option is to handle that validation in Power Apps before the data reaches the flow, where you have more control over how characters are counted.

     
      Vishnu WR
     
    Please  Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like 
     
  • Suggested answer
    chiaraalina Profile Picture
    2,425 Super User 2026 Season 1 on at
     
    As a workaround you could do this:
     
     
    length(replace('Hello 🚀''🚀''X'))

    This yields the human-expected count. In the above, “Hello 🚀” becomes “Hello X”, which length() correctly reports as 7. So you swap surrogate-pair emojis with single character, so you get the correct length.
     
    Hope it helps!
  • Suggested answer
    Haque Profile Picture
    3,653 on at
    Hi @AM-18061812-0
     

    The standard length() counts UTF-16 code units, so emojis like 🚀 count as 2. There is no simple built-in way in Power Automate to count user-perceived characters (grapheme clusters).

    Expensive though - if you need exact character counts including emojis, consider calling an Azure Function or external API that uses Unicode-aware libraries (e.g., ICU or JavaScript with Array.from()). Otherise, I agree with  .

     


    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard