# Character counting in a text

The Messaging API counts text characters in UTF-16 code units (16-bit). Characters made up of multiple code units (e.g. some Kanji characters, Unicode emojis) are counted as more than one character. For example, a Unicode emoji 🍎 is expressed in two code units. Thus 🍎 is two characters long, not one.

When the Messaging API counts a text that has a LINE emoji, the emoji placeholder ($) is replaced with the emoji's alternative text. Alternative text is the text displayed instead of the emoji on devices that can't display LINE emojis. Therefore, when sending a text message that has a LINE emoji, the text length may unintentionally exceed the maximum length and sending the message may fail. Note that LINE doesn't disclose the alternative text for LINE emojis.

However, the properties listed below are counted in grapheme cluster (opens new window) units, not in UTF-16 code units:

Type Property
All action objects
  • label
Postback action objects
  • displayText
  • fillInText
  • label
  • text
Message action objects
  • label
  • text
Buttons template messages
  • text
  • title
Confirm template messages
  • text
Carousel template messages
  • text
  • title
Rich menu objects
  • chatBarText
  • name