Keep the encoding declared in downloaded files
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 82/100
Research direction
Start in DownloadFileRequestHandler around lines 89-90, then compare the response reset used by ExternalRequestHandler and the /file/* encoding settings in web.xml. Check MIMETypeUtils.MIMETypeForFileExtension and MIMETypes.properties when handling extensions case-insensitively. Done means XML responses omit the forced charset while other formats retain current behavior, and the documented windows-1251 XML download renders correctly.
Written by the indexing model from the issue text.
Description
Description
A file that declares its own encoding other than UTF-8 is shown wrong in the web client: an XML file fails with error on line 2 at column 1: Encoding error instead of the document, and an HTML file with <meta charset="windows-1251"> is shown garbled. The web client sends every file as UTF-8, and the browser trusts this over the encoding declared in the file itself.
Steps to reproduce:
- Run an action that opens a file:
openFile() { INPUT f = FILE DO open(f); } - Pick an XML file in windows-1251, for example an EDI document that starts with
<?xml version="1.0" encoding="windows-1251"?>and has Cyrillic text, or an HTML report in windows-1251 with<meta charset="windows-1251">. - The browser shows
Encoding errorfor the XML file and garbled text for the HTML file.
Affects 6.3 and 7.0.
Reason
XML exchange formats (EDI, 1C exports and others) and older HTML reports often use windows-1251, and such files cannot be viewed from the web client.
Fix
A file that declares its encoding (an XML declaration with encoding, an HTML <meta> with charset, a CSS @charset) is sent without an encoding, so the browser reads the one declared in the file. Files that declare nothing (txt, csv, XML and HTML without a declaration, …) are still sent as UTF-8: without it, browsers guess their encoding from the user's locale and show UTF-8 text garbled.
- Dominant language
- Java
- Stars
- 214
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lsfusion/platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
All issues in lsfusion/platform
Similar issues
-
account assessment course feature lecture
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
app:learninggoalhub enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyPossibly taken @vaibhavgupta443 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/wicket#1991 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100