Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An issue with cross-platform support of unicode characters in paths #85

Open
birdofpreyru opened this issue Nov 13, 2024 · 2 comments
Open
Labels
In Progress Work in progress. P1 High priority issue.

Comments

@birdofpreyru
Copy link
Owner

Some unicode characters, e.g.  ö, can be represented in alternative ways (like a single character, or decomposed into a couple of characters, like o + "two upper dots modifier"); and different file systems might handle such characters differently; and in RN code we want to achieve uniform cross-platform behavior, thus perhaps need to level-out the differences.

So far I figured out:

  • Android conserves single-characters (composed form), like ö, in paths as they are. I have not checked / read what does it do with decomposed ö (represented as o + modifier).
  • iOS (and, I guess, macOS — to be verified) filesystem decomposes such characters, which on TS side can be expressed that given path string is transformed into path.normalize('NFD').
  • Windows — to be investigated.

What should we do? Perhaps, all paths returned by library methods should be normalized as NFC normalization (the default for JS string.normalize())?

@birdofpreyru
Copy link
Owner Author

For record: the decision I took — all paths and filenames returned by library functions should not be escaped in any way, and should be unicode-normalized to their NFC form, with the normalization, if necessary, done at the native side, for optimal performance.

Corresponding fix was done for readDir() on iOS, and macOS (see c530781), but I guess a similar fix might be needed for other iOS and macOS methods. I don't have capacity to thoroughly test every method now, thus I'll keep this ticket with In Progress and On Hold status, meaning I'll probably be further testing and fixing methods for this issue only as I bump into it causing problems to my projects.

@birdofpreyru birdofpreyru added the On Hold Blocked for some reason. label Nov 16, 2024
@birdofpreyru birdofpreyru removed the On Hold Blocked for some reason. label Nov 27, 2024
@birdofpreyru
Copy link
Owner Author

Perhaps, can be closed, but lets wait for #91, to verify there is no apparent issues with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Progress Work in progress. P1 High priority issue.
Projects
None yet
Development

No branches or pull requests

1 participant