API reference Development guidelines Quickstart Guides - Receiving messages (webhook)
- Sending messages
- Counting characters in a text
- Getting user IDs
- List of available stickers
- List of available LINE emojis
- Using audiences
- Using quick replies
- Using rich menus
- Get statistics per aggregation unit
- Try out rich menus on Rich Menu Playground
- Using LINE features with the LINE URL scheme
- Using beacons
- Sharing your LINE Official Account with users
- Linking user accounts
- Change icon and display name
- Retrying a failed API request
- Stop using your LINE Official Account
- Stop using the Messaging API
- Tutorial - Make a reply bot
LINE Bot Designer Flex Message Concepts Reference Resources
API reference Development guidelines Quickstart Guides - Receiving messages (webhook)
- Sending messages
- Counting characters in a text
- Getting user IDs
- List of available stickers
- List of available LINE emojis
- Using audiences
- Using quick replies
- Using rich menus
- Get statistics per aggregation unit
- Try out rich menus on Rich Menu Playground
- Using LINE features with the LINE URL scheme
- Using beacons
- Sharing your LINE Official Account with users
- Linking user accounts
- Change icon and display name
- Retrying a failed API request
- Stop using your LINE Official Account
- Stop using the Messaging API
- Tutorial - Make a reply bot
LINE Bot Designer Flex Message Concepts Reference Resources
# Counting characters in a text
In the Messaging API, characters in a text are counted in UTF-16 code units (16-bit). Characters expressed in multiple code units, such as some kanji characters and Unicode emojis, are counted as multiple characters instead of one character.
For example, a Unicode emoji 🍎 is expressed in two code units. Therefore, it's counted as two characters, not one.
The number of characters in a text including LINE emojis is counted with the placeholder for the each emoji ($
) in the text replaced by the alternative text (text for devices that can't display LINE emojis) of the LINE emoji to be used. Therefore, when sending a text message including LINE emojis, the number of characters in a text may unintentionally exceed the maximum number of characters and sending the message may fail. Note that the alternative text for each LINE emoji isn't disclosed.
However, the following properties are counted in grapheme cluster (opens new window) units, not in UTF-16 code units:
Type | Property |
---|---|
All action objects |
|
Postback action objects |
|
Message action objects |
|
Buttons template messages |
|
Confirm template messages |
|
Carousel template messages |
|
Rich menu objects |
|