Urgent.News

What's breaking now, across thousands of outlets.

Tech

PowerShell on Legacy Chinese Windows: UTF-8 with BOM or Bust

Windows PowerShell 5.1 does not guess encodings. When it loads a .ps1 file, it looks for a byte-order mark. If it finds one, it decodes accordingly. If it does not, it falls back to the system's ANSI code page — and on a Chinese Windows install, that code page is GBK (CP936). Every non-ASCII character in your script is then decoded through the wrong table, and you get mojibake that does not throw…

Windows PowerShell 5.1 does not automatically detect file encodings. When loading a .ps1 file, it looks for a byte-order mark. If present, PowerShell decodes the file accordingly. Without a BOM, it defaults to the system's ANSI code page. On Chinese Windows installations, this code page is GBK (CP936). As a result, non-ASCII characters in the script are decoded through the wrong table, causing mojibake that does not generate an error.

The issue led to a week of debugging after a deployment script created directories with incorrect names due to the misinterpretation of characters. The key to resolving the problem is ensuring all .ps1 files are saved as UTF-8 with a BOM and CRLF endings. Identifying the issue involves checking the first bytes of the file; a BOM like EF BB BF indicates UTF-8 with a BOM, while PowerShell 5.1 falls back to the ANSI code page without one.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Persistence Layer — Or, the Daemon You Never Agreed to Run

Last time I named the exit as its own layer (#58) — the cost of leaving is the layer that decides whether "own" was ever a choice.

  • Persistent daemon installed by default, runs silently in background.
  • Operates with granted privileges after uninstall, retains access to tokens and keys.
  • Sandboxing proposed to contain autonomous code, prevent unauthorized running.

Why Daily Stand-Ups Fail: Adapting Agile Ceremonies to Team Context

Walk into almost any engineering department, and you will see it. It is 9:15 AM. Eight developers are staring blankly at a Zoom grid or standing in a circle, waiting for their turn to mumble…

  • Daily stand-ups often fail due to lack of adaptation to team context.
  • Team maturity determines effectiveness of formal stand-ups.
  • Asynchronous check-ins are more effective for distributed teams.

SQL-Migration-Dryrun-Guard: Why Regex-Based Static Analysis Fails to Prevent Production Database Lockups

When performing zero-downtime database migrations on tables containing millions or tens of millions of rows, an unconsidered DDL statement can immediately lead to catastrophic exclusive locks ( ACCESS…

  • SQL-Migration-Dryrun-Guard tool aimed to prevent production database lockups
  • Tool relied on string matching and keyword detection, overlooking complex DDL cases
  • Architectural weaknesses: static analysis limitations and lack of handling subtransactions

More from Wednesday 14 October →