Symptom
Python code written inside a shell heredoc, an emoji inside the Python, and the surrogate pair gets broken. The script dies.
Cause
The shell → Python hop is one more encoding boundary. Each boundary applies its own rules.
Why this bites non-ASCII users
Emoji sit outside the Basic Multilingual Plane and CJK needs multi-byte sequences; ASCII never does. A heredoc that passes ASCII text untouched can still corrupt these.
Fix
Same reason we don't apply large patches via heredoc.