When writing a text message, the characters used will impact the type of encoding used by the phone.
The 2 most common character encoding types used by devices are:
GSM (7-bit alphabet), whose library contains 128 characters, including 10 escape ones (that count for 2 standard characters each). The maximum length of a text encoded in GSM is between 153 and 160 characters in length
Unicode (UCS-2), whose library contains more than 120 000 characters. The maximum length of a text encoded in Unicode is between 63 and 70 characters in length
The phone picks the encoding automatically, depending on the characters used. For example, the phone will convert the text into Unicode automatically, when using an emoji, a symbol or a letter with an accent (e.g. é).
The maximum size of a text message is always 140 bytes, but the number of characters will vary, depending on which ones are used.