Skip to content

feat(profiles): support Unicode profile names - #1

Open
Repulsor0915 wants to merge 1 commit into
Anong0u0:mainfrom
Repulsor0915:add/profiles
Open

feat(profiles): support Unicode profile names#1
Repulsor0915 wants to merge 1 commit into
Anong0u0:mainfrom
Repulsor0915:add/profiles

Conversation

@Repulsor0915

@Repulsor0915 Repulsor0915 commented Jul 21, 2026

Copy link
Copy Markdown

Summary

This PR expands profile name support beyond ASCII letters and numbers.

Profile names can now contain Unicode characters, including Chinese characters, spaces, accented text, and Emoji,
while continuing to use the existing data/profiles/<name>/ directory structure.

Changes

  • Normalize profile names to Unicode NFC
  • Detect duplicate names using Unicode case-folding
  • Support CJK characters, spaces, Emoji, dots, and most punctuation
  • Retain Windows-safe filename restrictions
  • Enforce the Windows 255 UTF-16 code-unit filename limit
  • Reject path separators, control characters, trailing dots/spaces, and reserved Windows device names
  • Create profiles through a staging directory before atomically moving them into place
  • Add rollback handling for failed profile rename operations
  • Return stable profile-related API error codes
  • Add localized error messages for English, Simplified Chinese, and Traditional Chinese
  • Encode profile names used in dynamic frontend selectors
  • Safely truncate default export filenames
  • Write backup schema v2 while retaining support for reading v1 and v2 backups
  • Add Rust and Playwright coverage for Unicode profile workflows

Examples

The following profile names are now supported:

  • 玩家 一號✨
  • 旅行者 二號🌙
  • Café
  • My Profile 2026

Unsafe Windows filenames such as CON, LPT1, bad/name, and names ending in a dot remain rejected.

The existing profile API and Profile structure remain unchanged. No internal profile ID was introduced.

@Repulsor0915 Repulsor0915 changed the title Allow chinese profile names and remove length limits feat(profiles): support Unicode profile names Jul 21, 2026
Anong0u0

This comment was marked as off-topic.

Anong0u0

This comment was marked as off-topic.

@Anong0u0
Anong0u0 dismissed stale reviews from themself July 22, 2026 09:03

Submitted without user authorization; dismissed to restore PR state.

@Anong0u0 Anong0u0 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR moves Unicode profile naming in the right direction, but several correctness and scope issues need to be addressed before merging.

P2 blockers

  • When Windows rejects CON .txt, COM1 .txt, or LPT1 .txt, distinguish an existing destination from an unsupported filename instead of returning profile_already_exists unconditionally
  • A rename that becomes a no-op after canonicalization must not migrate or delete the inactive profile's record-view preferences
  • When a backup has an NFC profile path but an NFD profile.json name, write the canonical name back to DiskProfile.name before restoring any files

P3 test fidelity

  • Remove the mock's toUpperCase()-based collision approximation; the mock must not be the source of truth for Windows filename validity or collision behavior

KISS design

  • The backend only rejects empty names, trims and NFC-normalizes input, and enforces a single path component; Windows filesystem operations determine filename support and collisions
  • Use actual filesystem resolution during backup merge instead of a custom Unicode case-insensitive key
  • The frontend and mock do not reimplement Windows filename validity, reserved-name, or Unicode collision rules

YAGNI removals

  • Remove the full Unicode case-fold uniqueness policy, the unicode-casefold dependency, case folding from profile_name_key(), and tests asserting Straße == STRASSE
  • Remove bidi-control validation, the Rust bidi helper, and the mock bidi regex
  • Keep backup schema version 1 because the format is unchanged, and remove version-2 manifest output, the version 1-or-2 reader branch, related assertions, and v2-specific naming

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