Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all script, css and html files are UTF-8 with BOM #266

Closed
Jaifroid opened this issue Jun 23, 2017 · 3 comments
Closed

Ensure all script, css and html files are UTF-8 with BOM #266

Jaifroid opened this issue Jun 23, 2017 · 3 comments
Assignees
Milestone

Comments

@Jaifroid
Copy link
Member

This would be very helpful in keeping kiwix-js and kiwix-js-windows in sync, since the files cannot be submitted to the Windows Store unless they conform. So I propose to do a PR with the scripts conforming to UTF-8 encoding with BOM, so that this can be tested on other OS's, particularly FFOS, to ensure there are no backwards compatibility issues.

@Jaifroid Jaifroid self-assigned this Jun 23, 2017
@Jaifroid Jaifroid added this to the v2.2 milestone Jun 23, 2017
@mossroy
Copy link
Contributor

mossroy commented Jun 23, 2017

I'm not so sure about this.
From what I read so far, Microsoft advises the use of BOM (and sometimes requires it). Probably because its default encoding is not UTF-8 : I suppose it's a way to avoid the encoding detection.
But everywhere else I see advises not to use it. For example https://stackoverflow.com/questions/2223882/whats-different-between-utf-8-and-utf-8-without-bom

More pragmatically, the default encoding on Linux is usually UTF-8 without BOM (as far as I know). Same for the Java language.
The IDE I use (NetBeans, based on Java) does not interpret the BOM. See https://netbeans.org/bugzilla/show_bug.cgi?id=161015 . I tested on you repo : it displays an extra "space" at the beginning of each file, and considers it as an error.
Any newly-created file on linux will also be in UTF-8 without BOM, and it's not so easy to change that (without changing it globally for the machine). So I think it might be difficult to keep this BOM everywhere with the time.

I would prefer to have a build task (in the windows repo) that converts the files from UTF-8 without BOM to UTF-8 with BOM, that is run after syncing with upstream (or before creating the windows app).

@Jaifroid
Copy link
Member Author

Jaifroid commented Jun 24, 2017

This is absolutely fine by me. The validation required for submitting an app to the Store throws an error with files that do not have the BOM, and gives some info about bytecodes and caching meaning that performance is much better on files compiled from files that conform. I raised this issue here because @kelson42 is keen to keep the differences between the two repositories to a minimum, to try to keep the basecode (kiwix-js) as "universal" as possible, which is why I'm proposing backports for things that are necessary in the kiwix-js-windows app but would make no real difference to the kiwix-js app.

In this case, it makes no sense to impose an arbitrary requirement on the developers of the kiwix-js app if their tools are not recognizing the BOM or if it otherwise causes problems in a Linux environment. I am very happy to merge changes from this repo into the kiwix-js-windows repo on a line-by-line basis for now (using a merge tool) and this doesn't affect the BOM. Doing it this way allows me to keep on top of any code differences in any case, and makes me feel more comfortable than an automatic process would at the moment. I'm happy either to close this issue or keep it open as a placeholder for automating the process at some future point, but I feel there are higher priorities right now!

@mossroy
Copy link
Contributor

mossroy commented Jun 24, 2017

Great, thanks.
Please keep on proposing backports, so that we can discuss them.

I've opened kiwix/kiwix-js-pwa#11 to automate the synchronization of source code, but I don't mind if you prefer to do that manually for now.
I close this issue as wontfix

@mossroy mossroy closed this as completed Jun 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants