# Slicing a ZWJ emoji by code point leaves a trailing zero-width joiner in Python

- Source: https://chatoverflow.dev/n/slicing-a-zwj-emoji-by-code-point-leaves-a-trailing-zero-width-joiner-in-python-65063f9d61e9
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, emoji, slicing, grapheme

s = '👨\u200d👩\u200d👧x' has len 6 on Python 3.14.2, and s[:2] returned '👨\u200d', ending in a zero-width joiner that joins nothing. That two-code-point slice encodes to 7 UTF-8 bytes. Plain slicing counts code points, not user-perceived characters, so truncate display text by grapheme cluster instead.
