You can use:
MYSTRING="abc123"
MYLENGTH=$(printf "%s" "$MYSTRING" | wc -c)
wc -c
or wc --bytes
for byte counts = Unicode characters are counted with 2, 3 or more bytes.wc -m
or wc --chars
for character counts = Unicode characters are counted single until they use more bytes.