Skip to content

Fix UTF-16BE text decoding for song titles and file paths#23

Open
MarlonS91 wants to merge 3 commits intoTobiasJacob:masterfrom
MarlonS91:fix/utf16be-decoding-and-jest-updates
Open

Fix UTF-16BE text decoding for song titles and file paths#23
MarlonS91 wants to merge 3 commits intoTobiasJacob:masterfrom
MarlonS91:fix/utf16be-decoding-and-jest-updates

Conversation

@MarlonS91
Copy link
Copy Markdown

@MarlonS91 MarlonS91 commented Feb 3, 2026

Summary

Fixes UTF-16BE text decoding in Serato library files and updates Jest test infrastructure to v25.

Changes

🐛 Fix: Correct UTF-16BE text decoding in 'tsng' and 'pfil' chunks

Problem:
The parser was using latin1 encoding for all text chunks by default, which failed to properly decode UTF-16BE encoded text in Serato library files. This caused emojis and special characters in song titles and file paths to display incorrectly.

Solution:
Added specific parsing logic for tsng (Song Title) and pfil (File Path) chunks:

  • Swap bytes to convert from big-endian to little-endian format
  • Decode as UTF-16LE to match Serato's encoding format
case "tsng":
case "pfil":
  data = buffer.slice(index + 8, index + 8 + length).swap16().toString('utf16le');
  break;

⬆️ Chore: Update Jest dependencies and test configuration

Dependency Updates:

  • @types/jest: 24.9.125.1.0
  • ts-jest: 24.3.025.2.0

Configuration Improvements:

  • Enhanced test regex: "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$"
    • Matches both /tests/ directory and .test./.spec. naming conventions
  • Added testPathIgnorePatterns: ["/node_modules/", "/lib/"]
    • Excludes build artifacts and dependencies from test runs

📦 Chore: Bump version to 1.3.2

Updated package version to reflect the bug fix and dependency updates.

Testing

  • Verify UTF-16BE text decoding with Serato files containing emojis
  • Confirm all existing tests pass with updated Jest configuration

Commits

  • 41d91f5 Chore: Bump version to 1.3.2
  • 403adc9 Fix: Correct UTF-16BE text decoding in 'tsng' and 'pfil' chunks
  • 3f7e5c5 Chore: Update Jest-related dependencies and refine test configuration

- Add UTF-16BE parsing for 'tsng' (Song Title) and 'pfil' (File Path) chunks
- Previously used latin1 encoding which failed to decode UTF-16BE text
- Now swap bytes and decode as UTF-16LE to match Serato's encoding format
@MarlonS91 MarlonS91 changed the title fix: Correct UTF-16BE text decoding in 'tsng' and 'pfil' chunks Fix UTF-16BE text decoding for song titles and file paths Feb 3, 2026
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.

1 participant