Skip to content

Commit d8a2c09

Browse files
committed
Added line to convert æøå
1 parent 8e659d9 commit d8a2c09

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)