Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## Unreleased

### Fixed

- Fix the dictionary build script incorrectly keeping redundant "character maps to itself" entries for characters outside the Basic Multilingual Plane (e.g. 𪙏), since `String.prototype.length` counts UTF-16 code units rather than code points. These entries are now correctly filtered out, slightly reducing dictionary size with no effect on conversion results. ([#49](https://github.com/nk2028/opencc-js/issues/49), reported by [@obxyann](https://github.com/obxyann), thanks!)

## 1.4.2 - 2026-08-22

### Changed
Expand Down
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function loadFile(fileName) {
if (!fileContentCache[fileName]) {
fileContentCache[fileName] = getEntries(fileName)
.map(([k, values]) => [k, values[0]]) // only select the first candidate, the subsequent candidates are ignored
.filter(([k, v]) => k !== v || k.length > 1) // remove “char => the same char” convertions to reduce file size
.filter(([k, v]) => k !== v || [...k].length > 1) // remove “char => the same char” convertions to reduce file size
.map(([k, v]) => k + ' ' + v)
.join('|');
const outputFile = getAbsPath(`./dist/esm-lib/dict/${fileName}.js`);
Expand Down
Loading