APK errors

In an SMS the letter ə cuts the message to 70 characters

Plain Latin letters fit 160 characters in one SMS. ə, ö, ü, ğ, ş, ç, and ı are not in that table. One of them moves the whole message to another table: the limit becomes 70. In a long message the parts split at 67 characters.

The Turkish operator table can hold ö, ü, ğ, ş, ç, and ı. ə is not there either. Most sending gates do not turn on the Turkish table, so all of these letters drop the message to 70.

Replacing the letter with e changes the word. əl and el are not the same. Count first.

  • The code prints two numbers. One hundred a characters are one part. The same hundred characters with ə in front are two parts.
  • ə alone is enough. The message goes to 70 even if the other letters are Latin.
  • 71 characters are two parts. After that the split is 67: up to 134 is two parts, 135 is three.
  • An emoji also drops the message to 70 and sometimes takes two places. This counter does not count that separately.
  • Removing the letter changes the meaning. See the part count before you send.
XUSUSI = set("əƏöÖüÜğĞşŞçÇıİ")

def hisseler(metn: str) -> int:
    ucs = any(h in XUSUSI for h in metn)
    n = len(metn.encode("utf-16-le")) // 2
    if not ucs:
        return 1 if n <= 160 else (n + 152) // 153
    return 1 if n <= 70 else (n + 66) // 67

print(hisseler("a" * 100))
print(hisseler("ə" + "a" * 99))

Related guides