DigiNews

Tech Watch by Johan Denoyer

← Back to articles

My Favorite Bugs: Invalid Surrogate Pairs

Quality: 8/10 Relevance: 9/10

Summary

Two emoji surrogate pairs triggered a rare bug in a CRDT-based editor, causing edits to disappear due to surrogate splits during string encoding. The article explains code units, code points, and grapheme clusters, how slice() can break characters, and describes the fixes (lib0 patch and making emoji an atomic node) and a modern grapheme-aware approach using Intl.Segmenter.

🚀 Service construit par Johan Denoyer