PowerShell 转码函数 Default->UTF8

 1 $chs='你好'
 2 
 3 function converToUft8($str){
 4 
 5 $bs=[System.Text.Encoding]::Default.GetBytes($str);
 6 
 7 $u8Char=[System.Text.UTF8Encoding]::UTF8.GetString($bs);
 8 return $u8Char;
 9 
10 }
11 
12 $enCode= converToUft8($chs)
13 echo $enCode
原文地址:https://www.cnblogs.com/micro-chen/p/5898736.html