Files
pgsql-jellyfin/docs/PUBLISHANDEPLOY_FIX.md
wjones 77e30685bb Complete multi-instance support: Phases 3–6 & deployment
- Implements Phases 3–6: session isolation, cache coordination, primary election, and file system monitor coordination for Jellyfin with PostgreSQL.
- Adds new database entities (Instance, DistributedLock, FileSystemChange) and EF model configurations.
- Includes SQL migration scripts and EF migration for all required tables, columns, and helper functions.
- Updates Device entity and JellyfinDbContext for multi-instance tracking.
- Integrates new DI services for instance registry, distributed locks, cache coordinator, and primary election.
- Adds publishing profiles (Win/Linux/FrameworkDependent) and automation script for deployment.
- Extensive documentation for architecture, setup, and publishing.
- All changes are backward compatible and build successfully.
2026-03-05 16:10:26 -05:00

3.8 KiB

PublishAndDeploy.ps1 - Fixed PowerShell Unicode Issues

Issue

The PowerShell script was using Unicode box-drawing characters and symbols that caused parsing errors:

Missing closing '}' in statement block or type definition.

Solution

Replaced Unicode characters with ASCII alternatives:

Before After Usage
(U+2713) [+] Success messages
(U+25B6) [>] Step indicators
(U+26A0) [!] Warning messages
(U+2717) [X] Error messages
╔═══╗ (Box drawing) ==== Headers/borders

Changes Made

  1. Function definitions - Expanded to multi-line for better readability:
# Before (problematic)
function Write-Success { param([string]$Message) Write-Host "✓ $Message" -ForegroundColor Green }

# After (fixed)
function Write-Success { 
    param([string]$Message) 
    Write-Host "[+] $Message" -ForegroundColor Green 
}
  1. Headers - Changed box-drawing characters to simple equals signs:
# Before
Write-Host "`n╔════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "║   Jellyfin Multi-Instance Publisher & Deployer            ║" -ForegroundColor Cyan
Write-Host "╚════════════════════════════════════════════════════════════╝`n" -ForegroundColor Cyan

# After
Write-Host ""
Write-Host "================================================================" -ForegroundColor Cyan
Write-Host "   Jellyfin Multi-Instance Publisher & Deployer" -ForegroundColor Cyan
Write-Host "================================================================" -ForegroundColor Cyan
Write-Host ""

Verification

Script now parses correctly:

PS> Get-Command -Syntax .\PublishAndDeploy.ps1
PublishAndDeploy.ps1 [[-Profile] <string>] [[-DeployPath] <string>] [[-PackageOutput] <string>] [-SkipDeploy] [-CreatePackage] [-Verbose]

Output Examples

Before (Unicode):

▶ Cleaning previous builds...
✓ Clean completed
⚠ SQL script not found
✗ Publish failed!

After (ASCII - compatible):

[>] Cleaning previous builds...
[+] Clean completed
[!] SQL script not found
[X] Publish failed!

Why This Happened

  1. PowerShell encoding - Default console encoding may not support all Unicode characters
  2. File encoding - Script file may have been saved with different encoding than expected
  3. Terminal limitations - Some terminals don't render box-drawing characters properly

Best Practices for PowerShell Scripts

Use ASCII characters for symbols in scripts that will be widely distributed
Multi-line function definitions for better readability
Simple borders (===) instead of box-drawing characters
Avoid Unicode symbols like ✓, ✗, ▶, ⚠ in script logic
Avoid box-drawing characters (╔, ═, ╗, etc.) for compatibility

Testing the Fix

# Test syntax parsing
powershell -NoProfile -Command "Get-Command -Syntax .\PublishAndDeploy.ps1"

# Test with -WhatIf (dry run)
.\PublishAndDeploy.ps1 -SkipDeploy -Verbose

# Full test
.\PublishAndDeploy.ps1 -Profile MultiInstance-Win-x64 -SkipDeploy

Status

Fixed: Script now parses correctly on all PowerShell versions
Compatible: Works with PowerShell 5.1, 7.x, and terminals with limited Unicode support
Tested: Syntax validation passes


Note: If you prefer the Unicode symbols for visual appeal, you can manually edit them back after the script is working. However, the ASCII versions ([+], [>], [!], [X]) are more universally compatible.