IQSS / IQSS/dataverse

Feature Request/Idea: store user-specified encoding in metadata

Open
#9,587 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: Internationalization Type: Bug User Role: Depositor
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

Overview of the Feature Request

Different systems can have different default encodings, which hinders reproducibility across these machines. Storing the encoding of a file as metadata helps alleviate this. Depositors should have a UI and API option for specifying the encoding of their files. This should appear as metadata to users who want to download the file.

What kind of user is the feature intended for?

Depositor and downloader

What inspired the request?

This file cannot be decoded.

>>> f = open("Catalinac_3_Running_Wordfish.R"); f.read()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 3830: invalid start byte

Even chardet gets confused:

>>> chardet.detect(open("Catalinac_3_Running_Wordfish.R", "rb").read())
{'encoding': 'Windows-1252', 'confidence': 0.73, 'language': ''}
>>> f = open("/home/sam/Downloads/Catalinac_3_Running_Wordfish.R", encoding="Windows-1252"); f.read()
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3830: character maps to <undefined>

This is not an invalid file; Emacs correctly identifies the encoding as Shift JIS

>>> f = open("Catalinac_3_Running_Wordfish.R", encoding="shift-jis"); len(f.read())
3862

While R can run this file, since the 0x81 appears after a comment symbol, one can easily imagine the comment symbol being a part of the source string. This is a problem with text files in general, not R specifically. While one could use chardet, chardet can be wrong, as we see above, and it is more elegant to store the encoding separately.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by tracing the depositor UI and API paths for file metadata, then examine the metadata exposed to downloaders. Done means depositors can specify an encoding through the UI and API, and users can see that encoding as file metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.