Sep-02-2023, 02:03 AM
hi.
I have a text file encoded utf-8
Reading it with i.e. notepad shows "sør-trøndelag"
Note the Norwegian character "ø"
Binary reading in Python, from txtfile utf-8 encoded, shows:
"115 195 184 114 45 116 114 195 184 110 100 101 108 97 103"
A CtkComboBox receives the content of txtfile above.
Its output (list content viewed) is:
"sør-trøndelag"
Decoding binary file using utf-8 shows correct letter ø in combobox:
sør-trøndelag
Decoding using ansi and latin-1, both shows:
sør-trøndelag
So,the utf-8 should be used here(?)
Which side of the combobox needs coding to get the proper strings shown in its list?
Attached is an image if text above mess up correct viewing.
Thank You in advance.
I tried to save the sør-trøndelag into a new ansi coded textfile and it shows the correct/expected result sør-trøndelag.
Should I encode the list sent to combobox into i.e ansi (donno what coding Python uses?)
edit 2: tried to input sør-trøndelag into combobox. It was shown in combobox without change.
[attachment=2518]
I have a text file encoded utf-8
Reading it with i.e. notepad shows "sør-trøndelag"
Note the Norwegian character "ø"
Binary reading in Python, from txtfile utf-8 encoded, shows:
"115 195 184 114 45 116 114 195 184 110 100 101 108 97 103"
A CtkComboBox receives the content of txtfile above.
Its output (list content viewed) is:
"sør-trøndelag"
Decoding binary file using utf-8 shows correct letter ø in combobox:
sør-trøndelag
Decoding using ansi and latin-1, both shows:
sør-trøndelag
So,the utf-8 should be used here(?)
Which side of the combobox needs coding to get the proper strings shown in its list?
Attached is an image if text above mess up correct viewing.
Thank You in advance.
I tried to save the sør-trøndelag into a new ansi coded textfile and it shows the correct/expected result sør-trøndelag.
Should I encode the list sent to combobox into i.e ansi (donno what coding Python uses?)
edit 2: tried to input sør-trøndelag into combobox. It was shown in combobox without change.
[attachment=2518]