Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1041

Start-Transcript always inserts a NULL character (0x00) after every Japanese character

$
0
0

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:

Open the result in notepad.exeOpen the result in binary editor

  • These characters are shown properly (without space caused by NULL) in Windows Terminal.
  • Start-Transcript cmdlet doesn't have -Encoding option. Character encoding of Start-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?


Viewing all articles
Browse latest Browse all 1041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>