镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(node:buffer): support utf16le search encoding - #2292

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-buffer-utf16le-search-encoding
May 28, 2026
Merged

proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-buffer-utf16le-search-encoding

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Part of #793.

Summary:

  • Recognize utf16le, utf-16le, ucs2, and ucs-2 in static Buffer encoding folding and runtime encoding parsing.
  • Encode Buffer.from(string, encoding) UTF-16LE aliases as little-endian UTF-16 byte pairs.
  • Decode buf.toString(encoding) UTF-16LE aliases and reuse the same string-to-bytes path for Buffer search string needles.

Verification:

  • DeepWiki: reference/deepwiki/nodejs-node-buffer-utf16le-search-encoding-2026-05-28.md.
  • Baseline exact node-suite/buffer/search/ucs2-and-buffer-needle: COMPILE FAIL, report test-parity/reports/parity_report_20260528_122044.json.
  • Final exact node-suite/buffer/search/ucs2-and-buffer-needle: PASS, report test-parity/reports/parity_report_20260528_122510.json.
  • Full node-suite/buffer/search: PASS 7/7, report test-parity/reports/parity_report_20260528_122551.json.
  • Full granular node-suite/buffer: 104 PASS / 12 parity FAIL / 0 compile FAIL, report test-parity/reports/parity_report_20260528_122604.json; target is green and the prior compile residual is gone.
  • cargo check -p perry-runtime -p perry-stdlib -p perry-codegen: PASS with existing warnings.
  • cargo fmt --check, jq empty test-parity/known_failures.json, and git diff --check: PASS.

Non-goals:

  • No buf.write(..., "utf16le") implementation.
  • No unknown-encoding error-shape cleanup.
  • No broad string-decoder/transcode work.
  • No unrelated Buffer coercion cleanup.

@proggeramlug
proggeramlug merged commit 48fa1b3 into PerryTS:main May 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants