A NUL byte inside a CSV cell is dropped by pandas and kept by the web engine
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, python
- Domain
- data
Research direction
Start with parseCSV() in assets/profiler-engine.js and the CSV loading path in faircode/loaders.py, then reproduce with the NUL-byte CSV from the issue using both python3 -m faircode profile and node scripts/engine-js.js profile. Both engines should reject text containing NUL with the suggested --encoding utf-16 message. Done means the new test in tests/test_js_parity_profile_parsing.py passes and the two engines give the same outcome on the repro file.
Written by the indexing model from the issue text.
Description
Where: assets/profiler-engine.js parseCSV(), faircode/loaders.py, tests/test_js_parity_profile_parsing.py.
Current gap: pandas' C parser truncates a field at an embedded NUL, so b\x00c becomes b; the JS parser keeps the whole string, so the label differs between engines. NULs are rare in real exports but common in corrupted or mis-decoded UTF-16 files, which is the situation where a clear error would help most.
Repro:
$ python3 -c "open('nul.csv','wb').write(b'sex,race\nm,a\nf,b\x00c\nm,a\n')"
$ python3 -m faircode profile nul.csv --json | python3 -c "import json,sys; print([g['label'] for g in json.load(sys.stdin)['dimensions'][1]['groups']])"
['a', 'b'] # node scripts/engine-js.js profile nul.csv gives ['a', 'b\x00c']
Suggested approach: reject text containing NUL in both engines with "the file contains NUL bytes - is it UTF-16? try --encoding utf-16" (which also feeds the mis-decoded-UTF-16 case), and test it.
- Dominant language
- HTML
- Stars
- 47
- Forks
- 45
- Avg merge
- 3h 15m
- Merged PRs (30d)
- 92
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yakew7/Fair-Code
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 57/100
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 3/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 3/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
All issues in yakew7/Fair-Code
Similar issues
-
author-page correction
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
acl-org/acl-anthology#10599 · 1 comment ·
Maintainers usually reply within 1 day
-
crate: spate-core priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-2 days Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[BUG] MIDAS fails on short multivariate or sampled seriesPossibly taken @AryanRG claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area: report enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ahmad-codex/shrinkvec#15 ·