Skip to content

macOS: normalize SDMC directory filenames#2080

Open
RigleGit wants to merge 1 commit intoazahar-emu:masterfrom
RigleGit:fix-macos-sdmc-unicode-normalization
Open

macOS: normalize SDMC directory filenames#2080
RigleGit wants to merge 1 commit intoazahar-emu:masterfrom
RigleGit:fix-macos-sdmc-unicode-normalization

Conversation

@RigleGit
Copy link
Copy Markdown



Ignore Until Your PR has been created!

This PR fixes #2079.

Tested with my homebrew on macOS 15.7.5, and not it works perfectly.

AI disclosure: I used ChatGPT/Codex (GPT-5.5 Low) to help me understand the issue, discuss possible locations in the filesystem code, and review some code. The final patch was reviewed, edited and tested manually.

@github-actions github-actions Bot added the needs verification Needs to complete an anti-AI challenge. label Apr 28, 2026
@github-actions github-actions Bot closed this Apr 28, 2026
@github-actions
Copy link
Copy Markdown

Welcome to the Azahar Emulator repository! Due to the surge of AI bots we have decided to add an extra verification step to new contributors. Please follow the exact instructions in your own written Pull Request description to reopen it.

@RigleGit
Copy link
Copy Markdown
Author

@RigleGit Azahar

@github-actions github-actions Bot reopened this Apr 28, 2026
@github-actions
Copy link
Copy Markdown

Verification successful! Pull request has been reopened. Please also edit your PR description to remove the block of text between --- to make the description easier to read.

@github-actions github-actions Bot removed the needs verification Needs to complete an anti-AI challenge. label Apr 28, 2026
Copy link
Copy Markdown
Member

@PabloMK7 PabloMK7 left a comment

Choose a reason for hiding this comment

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

Thanks for the chnage! A few minor notes.


// macOS filesystems may expose decomposed Unicode names through directory listings.
// Normalize to NFC before passing names to guest APIs that expect stable text.
std::string NormalizeUTF8ToNFC(std::string_view input) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you change this function name a bit? The name NormalizeNFDToNFC seems more appropriate.

const std::string& filename = file.virtualName;
// Directory entries are exposed to the guest as UTF-16. Normalize host UTF-8 names first
// so host Unicode normalization differences do not leak into guest-visible SDMC paths.
const std::string filename = Common::NormalizeUTF8ToNFC(file.virtualName);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be put between #ifdefs APPLE, as well as the entire normalize function itself. That way it is not left in the executable when not needed.

return entries_read;
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unneccessary newline?

@PabloMK7 PabloMK7 added this to the 2126.0 milestone Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS SDMC filename Unicode mismatch on accented characters

2 participants