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

Not working with Unicode #5

Closed
vasyl-shumskyi opened this issue Jul 18, 2017 · 2 comments
Closed

Not working with Unicode #5

vasyl-shumskyi opened this issue Jul 18, 2017 · 2 comments

Comments

@vasyl-shumskyi
Copy link

Seems like this great util doesn't like Unicode:

> require('slash')('a\\b\\c')
'a/b/c'
> require('slash')('a\\b\\ц')
'a\\b\\ц'
@sindresorhus
Copy link
Owner

From the top of the readme:

Forward-slash paths can be used in Windows as long as they're not extended-length paths and don't contain any non-ascii characters.

@overthebytes
Copy link

overthebytes commented Feb 20, 2019

I have read the link in the README and the link mentioned there. Below are excerpts from https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

The following reserved characters:

  • < (less than)
  • (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)
    Integer value zero, sometimes referred to as the ASCII NUL character.

Characters whose integer representations are in the range from 1 through 31, except for >alternate data >streams where these characters are allowed. For more information about file >streams, see File Streams.

Any other character that the target file system does not allow.

There is no need to perform any Unicode normalization on path and file name strings for use by the Windows file I/O API functions because the file system treats path and file names as an opaque sequence of WCHARs. Any normalization that your application requires should be performed with this in mind, external of any calls to related Windows file I/O API functions.

  • ...\path\to\français`
  • ...\path\to\deutschländisch
  • ...\path\to\中国語
  • ...\path\to\한국어
  • ...\path\to\にほんご
  • ...\path\to\♥♥♥♥♥

These are all valid paths in Windows.

Can you tell me if there is a problem with converting Unicode?

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

No branches or pull requests

3 participants