SnowStack.EncodingProbe.PowerShell

1.2.0

A PowerShell module for detecting the character encoding of text files. テキストファイルの文字エンコーディングを判定する PowerShell モジュールです。

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name SnowStack.EncodingProbe.PowerShell

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name SnowStack.EncodingProbe.PowerShell

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

Copyright © 2026 motoi.tsushima

Package Details

Author(s)

  • motoi.tsushima

Tags

encoding chardet charset text shift-jis euc-jp japanese bom utf8

Cmdlets

Resolve-Encoding Get-EncodingProbePlatformInfo Get-ProbedContent Set-ProbedContent Add-ProbedContent Out-ProbedFile Convert-ProbedContent ConvertTo-DotNetEncoding

PSEditions

Desktop Core

Dependencies

This module has no dependencies.

Release Notes

1.2.0
コマンドを 2 つ追加し、文字エンコーディング判定を東アジア以外の言語に対応させました。

- Out-ProbedFile : オブジェクトを整形してファイルへ出力します。標準の Out-File のパラメーターを
 すべて持ち、文字エンコーディング・BOM・改行を統一語彙で指定できます。-Encoding を省略すると
 PowerShell 5.1 と 7.x のどちらでも utf8NoBOM で書き、-Append では追記先の文字エンコーディングを継承して
 整合性を検査します。
- Convert-ProbedContent : 既存のテキストファイルの文字エンコーディング・BOM・改行を変換します。
 不正なバイト列や表現できない文字があるファイルは変換せず、文字を失わないことを保証します。

既存コマンドの変更:
- Set-ProbedContent / Add-ProbedContent の -Force は、書き込み後に読み取り専用の属性を元に戻すように
 なりました(標準の Set-Content / Add-Content と同じ)。
- -LineBreak が決めるのは要素の後ろに付ける改行だけで、文字列の中の改行は置き換えないことを明文化しました。
- Set-ProbedContent / Add-ProbedContent は、-WhatIf のときも読み取り専用などのエラーを報告するようになりました。

不具合の修正:
- PowerShell 7.x で、フレンドリ名の無い文字エンコーディング(windows-1252 など)の PSEncodingName に
 "I do not know." が入っていたのを null に直しました(1.0.0 から存在した不具合)。

判定の変更:
- 東アジア以外のカルチャーでは、Shift_JIS などの東アジアの旧マルチバイトの判定を行わなくなりました。
- 東アジアのカルチャーでも、欧米のシングルバイトのテキストを旧マルチバイトと誤判定しにくくなりました。
- UTF-8 の判定を厳密にしました。
- 香港・マカオのカルチャーに対応し、メッセージとヘルプは台湾と同じ繁体字の内容で提供します。

1.1.0
テキストの読み書きコマンドを追加しました。既存のコマンドと公開 API に変更はありません。

- Get-ProbedContent : 文字エンコーディングを判定してテキストファイルを読み込みます。
- Set-ProbedContent : 文字エンコーディング・BOM・改行コードを明示して書き込みます。
- Add-ProbedContent : 文字エンコーディングを保ったまま追記します。
- ConvertTo-DotNetEncoding : 各種の指定を System.Text.Encoding に変換します。

これらの -Encoding は統一語彙を受け付けます。同じ名前が PowerShell 5.1 と 7.x で同じ結果になり、
PowerShell 5.1 でも utf8NoBOM(BOM 無しの UTF-8)や shift_jis を名前で指定できます。
書き込みでは BOM 方針の定まらない裸の utf8 を受け付けません。utf8NoBOM または utf8BOM を指定してください。

Get-ProbedContent / Set-ProbedContent / Add-ProbedContent は、Resolve-Encoding と同じ
-Culture と -Strategy を受け取ります。日本語環境で韓国語や中国語のファイルを読むときは
-Culture ko-KR のように対象言語のカルチャーを指定してください。
欧米のテキストは -Strategy UtfUnknownOnly で読めます。

エラーメッセージは英語・日本語・韓国語・繁体字中国語・簡体字中国語に対応しています。
ヘルプ(Get-Help)も同じ 5 言語を同梱しています。

1.0.2
ライセンスリリース。Resolve-Encoding, Get-EncodingProbePlatformInfo コマンドレットを提供。

FileList

Version History

Version Downloads Last updated
1.2.0 (current version) 7 9/30/2026
1.1.0 27 9/1/2026
1.0.2 21 8/10/2026
1.0.0 27 7/14/2026
1.0.0-preview6 10 7/11/2026
1.0.0-preview5 6 7/8/2026
1.0.0-preview4 15 7/2/2026
1.0.0-preview3 8 6/23/2026
1.0.0-preview2 8 6/19/2026
1.0.0-preview1 10 6/7/2026
Show more