Bug 57018 - Classlists unexpected behavior
Classlists unexpected behavior
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Class lists
unspecified
Other Linux
: P5 normal (vote)
: UCS@school 5.0 v5
Assigned To: Alexander Steffen
Jürn Brodersen
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-02-01 09:17 CET by Alexander Steffen
Modified: 2024-03-21 15:49 CET (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.137
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2024013021000125
Bug group (optional): Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Steffen univentionstaff 2024-02-01 09:17:40 CET
Due to an oversight while fixing Bug #56403, a new bug got introduced.
The following was reported:

"Very weird one: a customer wants to export a class and needs the old format, so he used the 'alternative format' with utf-8 encoding and comma separated. The output though, is a file with just this chinese line:

楆獲湴浡ⱥ慌瑳慮敭䌬慬獳唬敳湲浡൥Ⰺ捓畨汥牥䐬浥歯慬獳ⱥ捳畨汥牥ല

"

The cause of the issue was detected by Florian Best, who found that a utf-16 charset is used when providing the file, no matter if the export was made with the utf-16 or utf-8 option.

However, testing on a VM did not provide the aforementioned behavior.
Additionally, the test did not catch this behavior as well and has to be adapted accordingly.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2024-02-02 16:08:13 CET
Just for completeness:

I suspect that the output was correctly exported as UTF8 encoded file and that somehow the customer's software expected a UTF16 encoding.

>>> '楆獲湴浡ⱥ慌瑳慮敭䌬慬獳唬敳湲浡൥Ⰺ捓畨汥牥䐬浥歯慬獳ⱥ捳畨汥牥ല'.encode('utf16')
b'\xff\xfeFirstname,Lastname,Class,Username\r\n,Schueler,Demoklasse,schueler2\r'

The customers spreadsheet software did it the other way around... it got the byte string with UTF-8-ByteOrderMark (BOM) and ASCII characters (also part of UTF-8) and assumed UTF-16 and decoded the bytestring accordingly → the chinese characters are shown to the customer.
Comment 3 Jürn Brodersen univentionstaff 2024-02-13 09:53:51 CET
As discussed, this will probably not fix the customer problem. But it will fix the wrong charset header
Comment 4 Alexander Steffen univentionstaff 2024-02-13 10:02:50 CET
Fixed with version 3.0.10 

The charset is now properly set depending on the encoding.
Tests where adapted for this
Comment 5 Jürn Brodersen univentionstaff 2024-02-13 10:11:30 CET
Looks good.

-> Recommended download set to charset: utf-16
-> Alternative download set to charset: utf-8
-> Recommended download works with excel out of the box, though it did work for me before as well :)
-> Tests
-> yaml

-> Verified
Comment 6 Johannes Königer univentionstaff 2024-03-21 15:49:47 CET
UCS@school 5.0 v5 has been released.

- https://docs.software-univention.de/ucsschool-changelog/5.0v5/en/changelog.html
- https://docs.software-univention.de/ucsschool-changelog/5.0v5/de/changelog.html

If this error occurs again, please clone this bug.