Is there a specified or de facto standard way to store file encoding metadata in JSON? If not, we could put the following inside entry.value.metadata
:
{
encoding: "utf-8" // or "iso-8859-1", "big5", etc.
}
If we implemented this in hypercore-fetch-ushin
, we could pass the encoding data inside a PUT request Content-Type
header.
Even if we don't end up storing the encoding system in the hyperdrive metadata, we may still want to store an
encoding
k/v pair in thehyperdrive-entry
ETC
slot. This could be set to the value oflast-coding-system-used
right after the call todecode-coding-string
(ordecode-coding-region
) after reading a file. We would then setlast-coding-system-used
to the encoding for the entry when it comes time to callafter-insert-file-set-coding
, perhaps in an async callback, such as when diffing a file at two versions.