Skip to content

Allocate buffer of correct size in NSURL.fileSystemRepresentation on Windows #5007

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

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

lxbndr
Copy link
Contributor

@lxbndr lxbndr commented Jul 13, 2024

As the String.withCString function provides utf-8 encoded content, we should not use String.count for receiving buffer length. NSURL.fileSystemRepresentation is used in FileHandle(forReadingFrom:), and it fails with file urls containing non-ascii (e.g. cyrillic) characters.

@lxbndr
Copy link
Contributor Author

lxbndr commented Jul 13, 2024

cc @compnerd

@jmschonfeld
Copy link
Contributor

@swift-ci please test Linux platform

@jmschonfeld
Copy link
Contributor

@swift-ci please test Windows platform

Copy link
Contributor

@jmschonfeld jmschonfeld left a comment

Choose a reason for hiding this comment

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

Makes sense to me!

@parkera parkera merged commit 8c68478 into swiftlang:main Jul 16, 2024
2 checks passed
@lxbndr lxbndr deleted the win-url-fsr-utf8 branch July 17, 2024 21:33
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.

3 participants