Saved in:
Bibliographic Details
Main Authors: Clausecker, Robert, Lemire, Daniel
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2601.06349
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915719880376320
author Clausecker, Robert
Lemire, Daniel
author_facet Clausecker, Robert
Lemire, Daniel
contents UTF-16 is a widely used Unicode encoding representing characters with one or two 16-bit code units. The format relies on surrogate pairs to encode characters beyond the Basic Multilingual Plane, requiring a high surrogate followed by a low surrogate. Ill-formed UTF-16 strings -- where surrogates are mismatched -- can arise from data corruption or improper encoding, posing security and reliability risks. Consequently, programming languages such as JavaScript include functions to fix ill-formed UTF-16 strings by replacing mismatched surrogates with the Unicode replacement character (U+FFFD). We propose using Single Instruction, Multiple Data (SIMD) instructions to handle multiple code units in parallel, enabling faster and more efficient execution. Our software is part of the Google JavaScript engine (V8) and thus part of several major Web browsers.
format Preprint
id arxiv_https___arxiv_org_abs_2601_06349
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Fixing ill-formed UTF-16 strings with SIMD instructions
Clausecker, Robert
Lemire, Daniel
Other Computer Science
Performance
UTF-16 is a widely used Unicode encoding representing characters with one or two 16-bit code units. The format relies on surrogate pairs to encode characters beyond the Basic Multilingual Plane, requiring a high surrogate followed by a low surrogate. Ill-formed UTF-16 strings -- where surrogates are mismatched -- can arise from data corruption or improper encoding, posing security and reliability risks. Consequently, programming languages such as JavaScript include functions to fix ill-formed UTF-16 strings by replacing mismatched surrogates with the Unicode replacement character (U+FFFD). We propose using Single Instruction, Multiple Data (SIMD) instructions to handle multiple code units in parallel, enabling faster and more efficient execution. Our software is part of the Google JavaScript engine (V8) and thus part of several major Web browsers.
title Fixing ill-formed UTF-16 strings with SIMD instructions
topic Other Computer Science
Performance
url https://arxiv.org/abs/2601.06349