Skip to content

Commit 59864e9

Browse files
authored
Merge pull request #64 from itk-dev-rpa/hotfix/base64_utf8
Added line to convert æøå
2 parents cb0a487 + 369f8c6 commit 59864e9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
## [2.5.0] - 2024-08-14
1212

1313
### Added
14+
- Conversion of ÆØÅ to Ae Oe Aa when uploading notes to Nova
1415

1516
- Added modules for use with the Eflyt / Dedalus / Notus address system
1617
- misc.file_util: handle_save_dialog

itk_dev_shared_components/kmd_nova/nova_notes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ def _encode_text(string: str) -> str:
6969
Ensure the base64 string doesn't contain padding by inserting spaces at the end of the input string.
7070
There is a bug in the Nova api that corrupts the string if it contains padding.
7171
The extra spaces will not show up in the Nova user interface.
72+
A necessary hack has been implemented to convert Æ, Ø and Å to ae, oe and aa.
7273
7374
Args:
7475
string: The string to encode.
7576
7677
Returns:
7778
A base64 string containing no padding.
7879
"""
80+
string = string.replace('æ', 'ae').replace('ø', 'oe').replace('å', 'aa').replace('Æ', 'Ae').replace('Ø', 'Oe').replace('Å', 'Aa')
81+
7982
def b64(s: str) -> str:
8083
"""Helper function to convert a string to base64."""
8184
return base64.b64encode(s.encode()).decode()

0 commit comments

Comments
 (0)