Univention Bugzilla – Bug 57018
Classlists unexpected behavior
Last modified: 2024-03-21 15:49:47 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.
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.
As discussed, this will probably not fix the customer problem. But it will fix the wrong charset header
Fixed with version 3.0.10 The charset is now properly set depending on the encoding. Tests where adapted for this
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
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.