Installer Script Encoding Automation: A Dash Character Was Silently Corrupting the Installer

A file has no encoding of its own — only a convention for how to guess it
A text file is, at the level bytes are actually stored, just a sequence of numbers — nothing in the file itself declares which character set those numbers are supposed to represent. A byte-order mark is a small, optional, invisible marker some encodings place at the very start of a file specifically to remove that ambiguity for whatever program opens it next. A file saved as UTF-8 WITHOUT that marker is, from the reading program's point of view, indistinguishable at the byte level from a file saved in an entirely different, older single-byte encoding for every character that happens to fall in the range both encodings share — which covers plain English letters, digits, and most punctuation, but not every accented letter or typographic dash. Two programs can each read the identical file, apply a different but individually reasonable guess about its encoding, and produce two different, both internally consistent, readings of the same bytes — with only one of them matching what the file's author actually typed.
How the underlying problem shows up before you fix it
A script fails with a parser error naming a term, a command, or a cmdlet that has nothing to do with the actual content the script's author wrote — because the parser is reading a STRING that was cut short mid-sentence by a misread character, then trying to interpret the leftover fragment as if it were a new, separate command.
The exact same script file, opened and inspected in a modern code editor (which defaults to reading files as UTF-8, with or without a byte-order mark), displays every character correctly and shows no visible sign of a problem at all.
The failure is specific to the exact execution engine reading the file: Windows PowerShell 5.1 (the version bundled with the operating system itself) reads an unmarked file differently than PowerShell 7 (a separately-installed, cross-platform engine many developers use for their own local testing) — meaning the bug can pass every check performed under one engine and fail unconditionally under the other, on the exact same unmodified file.
The specific characters most likely to trigger the failure are exactly the ones a legacy single-byte code page maps differently than UTF-8 does: accented letters, curly quotes, and typographic dashes — the kind of character a writer reaches for naturally in an ordinary title or description string, with no reason to suspect it carries any technical risk.
A build or packaging step that only checks a script for syntax validity under the SAME engine used to author it will not catch this at all, because the file is syntactically perfect under that engine — the defect exists only in how a DIFFERENT engine, reading the identical bytes, resolves the ambiguity a missing byte-order mark leaves behind.
Why an ordinary dash character was the exact kind of change most likely to trigger this
Plain ASCII text — ordinary English letters, digits, and basic punctuation like a hyphen or a straight quote — happens to occupy the identical byte values across UTF-8 and the common legacy single-byte code pages that predate it, which is exactly why a script written entirely in that narrow character set can be saved without a byte-order mark and still behave identically under either interpretation, for years, without anyone noticing the ambiguity exists at all. The moment a script's author reaches for a character outside that narrow shared range — a longer, typographically distinct dash instead of a plain hyphen, a genuine curly quote instead of a straight one, an accented letter in a name — the two encodings diverge, and a file with no byte-order mark to resolve that divergence becomes genuinely ambiguous for the first time. The installer script had almost certainly worked correctly for a long time before this specific change, for the same reason most files like it do: nothing had yet been typed into it that actually exposed the gap.
How Centriu Guardian closed the gap at the point the installer package is actually built
Centriu Guardian's installer is packaged by a dedicated build script that assembles every file the setup process needs — agent binaries, configuration, and a handful of PowerShell scripts responsible for the installation logic itself — into a single distributable package. Before this fix, that packaging step copied each `.ps1` file into the package exactly as it existed on disk, byte for byte, with no attention paid to how the file had been encoded or whether a byte-order mark was present. Whatever ambiguity already existed in the source file simply carried forward unchanged into the shipped installer, to be resolved — correctly or not — by whichever PowerShell engine version happened to run it on an end user's own machine.
The fix inserts an explicit encoding-normalization step directly into the packaging process, applied to every `.ps1` file the installer package contains, with no exceptions carved out for any individual script. Each file is read back in as UTF-8 text — the correct, intended encoding all along, and the one every modern editor already assumes by default — and then written back out with an explicit UTF-8 byte-order mark prepended. That marker removes the ambiguity a plain UTF-8 file otherwise leaves behind: any PowerShell engine encountering it, including the older 5.1 engine that ships with Windows itself, now reads the file's actual bytes using the correct table, rather than falling back to a legacy guess that happens to diverge from UTF-8 for exactly the characters most likely to appear in ordinary, human-written text. The fix's own commit records a direct parse-check confirming all five of the installer's packaged scripts parse cleanly after the rewrite, and a full headless installation test — extracting the freshly rebuilt package and running the installer logic end to end — confirming the agent actually starts and reports itself healthy afterward, not merely that the script's syntax now parses without error.
What is actually built today
Centriu Guardian's installer packaging step reads every bundled `.ps1` file as UTF-8 and rewrites it with an explicit byte-order mark before the setup package is assembled — applied uniformly to all packaged scripts, not selectively to the one that happened to trigger the original failure.
The fix removes the underlying ambiguity at its source (the file's own encoding marker) rather than working around a single problem character — a future script added to the package inherits the same correct handling automatically, without needing its own individual review for encoding safety.
The packaging build includes a direct parse-check of every packaged script as part of the same change, confirmed clean across all five scripts the installer ships today.
A full, real installation was run from the freshly rebuilt package as part of confirming the fix — not merely a syntax check, but an actual install that starts the agent process and confirms it reports itself healthy.
The same commit also replaced the installer's original plain console experience with a native graphical installer for the common case, while keeping the console path (the one this specific bug affected) available as a documented alternative.
A word swapped for a look-alike in translation, breaking the sentence after it (illustrative framing of the actual measured finding)
Before the fix, one specific mark of punctuation in the installer's own script text — like a word replaced with a visually similar one during a careless translation — was silently read as a completely different mark by the exact tool actually running the script on a typical Windows machine, closing a sentence early and leaving the words after it to be misread as something else entirely, producing an error about a term nobody had actually written. After the fix, the script's own file explicitly states which alphabet it was written in, so the tool reading it never has to guess — and never again substitutes one mark for another.
What changes operationally
Centriu Guardian's packaged installer scripts now carry an explicit encoding marker confirming they should be read as UTF-8, closing a gap where a missing marker had left Windows's own built-in PowerShell engine to guess — incorrectly, for specific punctuation characters — and silently corrupt the script's own text before ever reaching the point of executing it.
When this is not the right fit
This automation covers specifically how Centriu Guardian's own installer PACKAGE is built and encoded before it reaches an end user's machine. It is a distinct concern from this pillar's separate pages on the installer's runtime behavior once it is already running correctly — how it detects an outdated locally-installed agent, or how it handles an elevated script that exceeds Windows's own command-line length limit — each of those covers a different stage of the same overall installation and update pipeline.
Guessing an encoding vs. declaring it explicitly
Leaving a text file's encoding unmarked and trusting whatever reads it next to guess correctly works, in practice, for as long as nobody writes a character outside the narrow range every common encoding happens to agree on — which can be a very long time for a script that started out using only plain ASCII punctuation. Declaring the encoding explicitly, with an actual marker at the start of the file, removes the guess entirely: every reader, regardless of its own default assumption or the specific engine version running it, arrives at the identical, correct interpretation of the exact same bytes.
Related systems
Main system: Centriu Guardian.
What it does NOT do
- Does not change anything about what the installer script actually DOES once its text is correctly read — this fix corrects only how the file's bytes are interpreted, not the installation logic itself.
- Does not require any packaged script to avoid non-ASCII characters going forward — the fix's entire purpose is to make characters like an em dash or an accented letter safe to use, by removing the encoding ambiguity that made them risky in the first place.
- Does not affect files outside the installer's own packaged `.ps1` scripts — the encoding-normalization step is scoped specifically to that packaging process.
- Does not claim every possible legacy-code-page misreading scenario across every conceivable character was individually tested — the fix closes the general mechanism (an unmarked file being read under the wrong code page) confirmed to have caused this specific, real failure.
- Does not remove the console installation path this bug affected — a native graphical installer was added as the more common default in the same commit, but the console path remains available, now correctly encoded, as a documented alternative.
Security and governance
Centriu Guardian's packaged installer scripts now carry an explicit UTF-8 byte-order mark, closing a reliability gap where an unmarked file could be silently misread under a legacy code page and corrupted before executing — confirmed by a direct parse-check of every packaged script plus a full, real installation test after the rewrite. Any personal or business data referenced in Guardian's fleet and device records remains subject to Brazil's LGPD (Law No. 13,709/2018). Full detail on access control lives at /governanca and /iso.
Pricing and contracting
Available by monthly subscription, with tiered plans. Values and terms come from the official pricing table at /precos (Centriu's central source — never restated here).
Frequently asked questions
Why did the error message name "Windows" specifically — is this a Windows bug?
No — it is a byproduct of exactly where the string was cut short. The script's text happened to continue with a word Windows's own PowerShell then tried, and failed, to interpret as a separate command; a different string, cut at a different point, would have named a different, equally unrelated term. The underlying cause is entirely in how the file's own encoding was read, not in Windows itself.
Why did this only fail for some users and not others?
It depended on which PowerShell engine actually ran the script. Windows PowerShell 5.1, which ships with a stock, unmodified Windows installation, reads an unmarked file under a legacy code page. PowerShell 7, a separately installed, cross-platform engine many developers already have on their own machines, does not have the same default — so the identical file could behave correctly under one and fail under the other.
Could this have been caught by testing the script before it shipped?
Only by testing it specifically under Windows PowerShell 5.1 on a genuinely unmodified installation — testing under a developer's own PowerShell 7 environment, or simply opening the file in a code editor (which reads it as UTF-8 by default, with or without the marker), would not have surfaced the gap at all.
Does adding a byte-order mark ever cause its own problems?
For the class of file affected here — a script read by an interpreter that understands the marker — no; it simply removes an ambiguity that would otherwise be resolved by a guess. The fix's own commit confirms a parse-check across all five packaged scripts passed cleanly after the change.
What does Centriu Guardian cost?
It is sold by subscription with a published starting price — exact current values are on the central pricing page.
See how Centriu Guardian keeps its installer scripts encoding-safe
Reach our commercial team directly, or leave your details below — we'll follow up with guidance for your case.