itinance / itinance/react-native-fs
Encoding 'ascii' on readFile returns raw bytes
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Looking through the source for readFile() so I could get the raw bytes, I noticed 'ascii' returns raw bytes, not ASCII. (So less work for me, but confusing.)
In RNFSManager.java readFile(), the file's raw bytes are encoded to base64 and returned to FS.common.js readFile(), which then, if encoding is 'ascii', converts it back to raw bytes with base64.decode().
Maybe 'ascii' should be renamed 'raw' or similar. An 8-bit bytestream can cause problems over a transport or comms line that expects ASCII, especially if the transport further encodes 7n1. Also, based on the source file format, I would expect "ascii encoding" to have basic ascii remapping, which the function doesn't even attempt (understandably).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.