Skip to content

SD make83Name doesn't allow extended ASCII characters #4121

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

Closed
mcaldwelva opened this issue Nov 9, 2015 · 3 comments
Closed

SD make83Name doesn't allow extended ASCII characters #4121

mcaldwelva opened this issue Nov 9, 2015 · 3 comments
Assignees
Labels
feature request A request to make an enhancement (not a bug fix) Library: SD The SD Arduino library

Comments

@mcaldwelva
Copy link

This line of code is overly restrictive:

if (i > n || c < 0X21 || c > 0X7E)return false;

Windows will use extended ASCII in short file names if they are present in the long file name. Based on the Wikipedia entry for FAT 8.3 file naming, something like this seems more appropriate:

if (i > n || c < 0x20 || c == 0x7F) return false;

I hope you will consider making a change along these lines in the future. Thanks!

@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Library: SD The SD Arduino library labels Nov 11, 2015
@cmaglie
Copy link
Member

cmaglie commented Nov 11, 2015

@mcaldwelva
looking at this article from Microsoft:

https://support.microsoft.com/en-us/kb/142982

it seems that spaces are not allowed in 8.3 so they should not be allowed (with c < 0x20).

Also I'm not sure that extended chars (>0x7F) are allowed, the article above leave this case undefined. Are you sure that it's possible? Does this patch solve a real world issue?

@mcaldwelva
Copy link
Author

Thanks for the quick response! Yes, this is a problem that anyone might
encounter. I discovered it when I realized that the SD library wasn't
finding several files on my card and narrowed it down to those with Latin
characters. Here are a couple examples of long names and the Windows
generated short names:

  1. ¿Por Qué Te Vas_.mp3
    06¿POR~1.MP3
  2. Penélope.mp3
    05PENÉ~1.MP3

Windows shouldn't generate short file names with spaces, but other systems
may. I believe space is allowed anywhere except for the first char, but
there is a separate line of code to handle that case. Thanks,

.Mike

On Wed, Nov 11, 2015 at 10:23 AM, Cristian Maglie [email protected]
wrote:

@mcaldwelva https://github.com/mcaldwelva
looking at this article from Microsoft:

https://support.microsoft.com/en-us/kb/142982

it seems that spaces are not allowed in 8.3 so they should not be allowed
(with c < 0x20).

Also I'm not sure that extended chars (>0x7F) are allowed, the article
above leave this case undefined. Are you sure that it's possible? Does this
patch solve a real world issue?


Reply to this email directly or view it on GitHub
#4121 (comment).

@agdl
Copy link
Member

agdl commented Jul 12, 2016

This issue was moved to arduino-libraries/SD#3

@agdl agdl closed this as completed Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request to make an enhancement (not a bug fix) Library: SD The SD Arduino library
Projects
None yet
Development

No branches or pull requests

3 participants