Re: [PATCH v4 0/4] Maintenance IV: Platform-specific background maintenance
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 17, 2020, 23:54 UTC
- Message-ID
- <CAPig+cQCyWKzhm-LUBJ8Xm71KMq=6F+xpeLTCRXNoagtgXAwUg@mail.gmail.com>
- In-Reply-To
- <pull.776.v4.git.1605647598.gitgitgadget@gmail.com>
On Tue, Nov 17, 2020 at 4:13 PM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 7 quoted lines
> * I noticed far too late that while my example XML files had been edited > with UTF-8 encoding, Git is actually writing them as US-ASCII. Somehow > xmllint and launchd are not complaining, but schtasks does complain. > Unfortunately, I cannot find a way to catch this problem other than to > install my tip version on all three platforms and go through the entire > git maintenance start process, and double-check that the processes are > running on the hour.
I'm having trouble understanding what problem is being described here and whether or not it has been solved by v4.
I might guess that you are saying that `schtasks` insists upon seeing a UTF-8 BOM at the start of the XML file since the XML file declares itself as UTF-8, but that Git is (quite naturally) writing out the file without the UTF-8 BOM.
> - xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" > + xml = "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>\n"
If the above speculation is correct, and if `schtasks` is happy with the plain text file (lacking UTF-8 BOM) declaring itself as US-ASCII, then this seems a reasonable solution. And it's easy to test that this doesn't get broken. After validating the file with `xmllint`, also grep it for US-ASCII, perhaps like this:
test_xmllint "schedule-$frequency.xml" &&
grep "encoding=.US-ASCII." "schedule-$frequency.xml"