Skip to content

fix: preserve non-ASCII characters in CSV output#280

Open
1junh wants to merge 1 commit into
jakehildreth:mainfrom
1junh:fix/export-csv-utf8-encoding
Open

fix: preserve non-ASCII characters in CSV output#280
1junh wants to merge 1 commit into
jakehildreth:mainfrom
1junh:fix/export-csv-utf8-encoding

Conversation

@1junh

@1junh 1junh commented Jun 17, 2026

Copy link
Copy Markdown

Summary

When a certificate template name contains non-ASCII characters (e.g. Japanese), Invoke-Locksmith writes them as ? in its CSV output. The affected files are *ADCSIssues.CSV (Mode 2) and *ADCSRemediation.CSV (Mode 3).

Example (Mode 2), template name 脆弱テンプレートESC1:

Before: "yamato.local","ESC1","????????ESC1", ...
After:  "yamato.local","ESC1","脆弱テンプレートESC1", ...

Root cause

The two Export-Csv calls don't specify -Encoding, so they fall back to the cmdlet's default — and that default differs by PowerShell version.

References:

Fix

Add -Encoding UTF8 to the two Export-Csv calls in Public/Invoke-Locksmith.ps1. UTF8 is a valid value on both Windows PowerShell 5.1 and PowerShell 7+.

Testing

Ran Invoke-Locksmith -Mode 2 -OutputPath . on Windows PowerShell 5.1 against a forest containing a template whose name includes Japanese characters. Before the change the name was written as ?; after the change the CSV preserves the characters correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant