earlephilhower / ESP8266SdFat

Arduino FAT16/FAT32 Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for utf-8 file names

marcboon opened this issue · comments

In my project I am reading audio files from different types of SD cards, ranging from 1GB to 128GB capacity, Fat16, FAT32, and exFAT, and all are supported without changing code, which is great, but I'm missing support for utf-8 filenames.

I understand that your ESP8266SdFat library is a fork of Greiman/SdFat. In what ways is it different? You're library is based on Greiman's v2.0.2, while Greiman's latest is 2.1.0, and apparently does support utf-8 file names.

I tried to just replace ESP8266SdFat with Greiman's latest SdFat, but then I get tons of error messages. I'm not sure what is the reason for that. Maybe you can enlighten me.

I'm using Arduino-esp8266-3.0.2

As you found out, the upstream version of this library is unfortunately incompatible with the ESP8266 core. It has an incompatible File implementation as well as some other name conflicts, hence this version which basically just wraps everything in a namespace.

I'll see about pulling upstream into this version. Normally it's a painless process...

What I did just now was to force the use of Greiman's SdFat by changing it's library.json so that the target explicitly mentions esp8266, instead of just the wildcard (*). This way the library conflict resolver favours SdFat 2.1.0 over ESP8266SdFat.
Of course I also had to remove any references to SD, so I'm only using classes SdFs and FsFile. This works. I can now read utf-8 filenames in directory listings. I'm still having difficulty opening files using utf-8 names, but that's another problem.

Slightly off-topic, but related: I'm also using your ESP8266Audio library (which is great!). To be able to use SdFat as source, I created a AudioFileSourceSdFat class, very similar to your AudioFileSourceSD class, but using SdFat instead of SD, and with a SdFs* member (assigned in the constructor) in place of the global SD.

Done in latest core.