In my simple java program I convert an UTF-8 string to byte array with getBytes()
function, and I run System.out.println()
command.
When I convert this UTF-8 string in PowerShell to byte array, and I run Write-Host
command, the strings aren't equal.
This is my Powershell code:
System.BitConverter]::ToString([System.Text.Encoding]::UTF8.GetBytes("1234AbCd"))
This returned with this string: 31-32-33-34-41-62-43-64c
In Java:
String message;
message = "1234AbCd";
System.out.println(message.getBytes(StandardCharsets.UTF_8));
This returned with this string: [B@2401f4c3
What's the problem?