~ushin/ushin#211: 
Store file encoding metadata along with file contents

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.
}

Discussion in hyperdrive

Discussion in hypercore-fetch

If we implemented this in hypercore-fetch-ushin, we could pass the encoding data inside a PUT request Content-Type header.

Status
REPORTED
Submitter
~ushin
Assigned to
No-one
Submitted
7 months ago
Updated
7 months ago
Labels
hypercore-fetch-ushin

~ushin referenced this from #210 7 months ago

~ushin 7 months ago

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 the hyperdrive-entry ETC slot. This could be set to the value of last-coding-system-used right after the call to decode-coding-string (or decode-coding-region) after reading a file. We would then set last-coding-system-used to the encoding for the entry when it comes time to call after-insert-file-set-coding, perhaps in an async callback, such as when diffing a file at two versions.

Register here or Log in to comment, or comment via email.