equinor / equinor/roffio

Lack of support for special letters like ø æ å

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
_roffio.parser.as_ascii decodes string fields with bytes.decode("ascii"), which raises UnicodeDecodeError when a ROFF file contains any byte ≥ 0x80 in a string (e.g. parameter codeNames). This makes the whole file unreadable even though only a single string entry is affected, and even though all numerical data is intact.

**To Reproduce**
Seen through xtgeo

```
import xtgeo
g = xtgeo.create_box_grid(dimension=(4,2,4))
p = xtgeo.GridProperty(g, discrete=True)
p.codes = {0: "øæå"}
p.to_file("some.roff")
```

triggers

`UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)`

**Expected behavior**
Should be able to read and write code names with e.g. norwegian special letters

**Desktop (please complete the following information):**
- OS: Linux (etc, I suppose)
- Version RHEL8

**Additional context**
RMS can write ROFF files with e.g. code names "Havsø", but reading that with roffio (in xtgeo) will fail

Contributor guide

Open the contributing guide

Research direction

Start at roffio.parser.as_ascii and reproduce the failure with the xtgeo example using code names such as "øæå". Trace the string decoding and writing paths, then verify that ROFF files with non-ASCII code names can be read and written without making numerical data unreadable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.