Background
I am using Start-Transcript
/Stop-Transcript
cmdlet to save the messages of commands launched from my PowerShell script.
Problem
I ran commands that contain Japanese characters in messages like this:
PS C:\tmp> Start-Transcript -Path 'C:\tmp\Start-Transcript.txt'トランスクリプトが開始されました。出力ファイル: C:\tmp\Start-Transcript.txtPS C:\tmp> pktmon etl2txt C:\tmp\ETW\pktmon_curl_http_capture.etl処理しています...書式設定されたイベント: 1496書式設定されたファイル: C:\tmp\ETW\pktmon_curl_http_capture.txtPS C:\tmp> Stop-Transcriptトランスクリプトが停止されました。出力ファイル: C:\tmp\Start-Transcript.txtPS C:\tmp>
But in the result of Start-Transcript
, NULL characters (0x00
) are inserted after every Japanese character like this:
- These characters are shown properly (without space caused by NULL) in Windows Terminal.
Start-Transcript
cmdlet doesn't have-Encoding
option. Character encoding ofStart-Transcript
is fixed to UTF-8 with BOM. Japanese characters themselves are saved properly.- Japanese characters in the header/footer don't have trailing NULL characters.
Question
Is there any way to stop Start-Transcript
from inserting a NULL character (0x00
) after Japanese characters?