Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
tag:
description: Reviewed GitHub release tag
required: true
default: v1.5.0
default: v1.5.1
type: string
permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.5.1 — 2026-10-29

- Repair word-final Latin-1 æ misdecoded as CP850 µ, such as Kastanjetrµ, during
opt-in mojibake repair.

## 1.5.0 — 2026-10-27

- Rename ParsedMessage.area_code to area, including serialized message fields.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Repository: [`golded-ftn-python`](https://github.com/golded-dev/golded-ftn-python).
The distribution remains `golded-ftn`; imports use `golded_ftn`.
The source is public on GitHub. [Version 1.5.0 is available on PyPI](https://pypi.org/project/golded-ftn/1.5.0/).
The source is public on GitHub. [Version 1.5.1 is available on PyPI](https://pypi.org/project/golded-ftn/1.5.1/).

Install with Python 3.12 or newer:

```sh
python -m pip install golded-ftn==1.5.0
python -m pip install golded-ftn==1.5.1
```

Shared FTN message values, reader/writer protocols and text helpers for Python
Expand All @@ -21,7 +21,7 @@ git clone https://github.com/golded-dev/golded-ftn-python.git
cd golded-ftn-python
uv sync --locked
uv build
python -m pip install dist/golded_ftn-1.5.0-py3-none-any.whl
python -m pip install dist/golded_ftn-1.5.1-py3-none-any.whl
```

```python
Expand Down
4 changes: 2 additions & 2 deletions RELEASE-SHA256.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
2119b573a56f7779ab013589b23d004ef4d4f2390a4c0530269a57dd1e6d1b17 dist/golded_ftn-1.5.0-py3-none-any.whl
77edb452254be66992dd3894175a4dd4c2964403d125ed5eb616bdf648bb1be0 dist/golded_ftn-1.5.0.tar.gz
a5f8d0cae62acfc377201c10151ca8db0cb8454f531a5d63f5208adb6246ba8a dist/golded_ftn-1.5.1-py3-none-any.whl
c0975141e2ef5ddcc3aaca5e79cc16f63f83730e674364c14fce6910fabcbfb5 dist/golded_ftn-1.5.1.tar.gz
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "golded-ftn"
version = "1.5.0"
version = "1.5.1"
description = "Shared FTN message contracts, values and text helpers"
readme = "README.md"
requires-python = ">=3.12"
Expand Down
4 changes: 3 additions & 1 deletion src/golded_ftn/mojibake.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def _score(text: str) -> float:
_LITERAL_DEGREE.sub("", text).count("°") if c == "°" else text.count(c)
for c in _DAMAGE
)
damage += len(re.findall(r"[A-Za-z]µ(?=[A-Za-z])", text))
# µ after a letter is usually æ (Latin-1 read as CP850), including word-final
# subjects like Kastanjetrµ. Keep "10 µm" alone: space before µ.
damage += len(re.findall(r"[A-Za-z]µ", text))
return (
-2.5 * damage
+ 1.5 * sum(text.count(c) for c in _PLAUSIBLE)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_mojibake_regressions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from golded_ftn import repair_mojibake


def test_repairs_trailing_mu_in_danish_subject() -> None:
"""HAVEN msg 64 subject: Latin-1 æ read as CP850 µ at end of word."""
result = repair_mojibake("Kastanjetrµ")
assert result.text == "Kastanjetræ"
assert result.changed


def test_preserves_spaced_temperature() -> None:
result = repair_mojibake("20 °C")
assert result.text == "20 °C"
Expand Down
Loading