sensorfu / cargo-bom

Bill of Materials for Rust Crates
MIT License
16 stars 5 forks source link

Weird formatting #23

Closed MoritzSpiller closed 7 months ago

MoritzSpiller commented 1 year ago

Hi,

unfortunately, my output in BOM.txt looks like that when opening in VS Code or Notepad++: ÔöîÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö¼ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö¼ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÉ Ôöé Name Ôöé Version Ôöé Licenses Ôöé Ôö£ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö╝ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö╝ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöñ Ôöé anyhow Ôöé 1.0.71 Ôöé Apache-2.0, MIT Ôöé Ôö£ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö╝ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔö╝ÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöñ Ôöé blinkstick-rs Ôöé 0.3.2 Ôöé MIT Ôöé

Any idea what went wrong?

Thanks Moritz

oherrala commented 1 year ago

@moritz-surag The file should be UTF-8 encoded. Try changing VS Code's or Notepad++'s encoding to UTF-8 and see if that helps?

This is how it should look like:

% file rust-bom.txt 
rust-bom.txt: Unicode text, UTF-8 text

% head -n 13 BOM.txt
┌───────────┬─────────┬─────────────────┐
│ Name      │ Version │ Licenses        │
├───────────┼─────────┼─────────────────┤
│ anyhow    │ 1.0.68  │ Apache-2.0, MIT │
├───────────┼─────────┼─────────────────┤
│ cargo     │ 0.67.0  │ Apache-2.0, MIT │
├───────────┼─────────┼─────────────────┤
│ itertools │ 0.10.5  │ Apache-2.0, MIT │
├───────────┼─────────┼─────────────────┤
│ structopt │ 0.3.26  │ Apache-2.0, MIT │
├───────────┼─────────┼─────────────────┤
│ tabled    │ 0.10.0  │ MIT             │
└───────────┴─────────┴─────────────────┘
MoritzSpiller commented 1 year ago

unfortunately, this does not help. Converting the file to UTF-8 does not change anything. I'm using Windows, if that makes any difference? I'm attaching my file here. How does it look for you? 2023-07-27_SBoM.txt

oherrala commented 1 year ago

@moritz-surag Thanks! Yes, it looks like there might be a problem in Windows. We have only used this tool in Linux and macOS. I'll need to try to replicate this issue in Windows myself.

oherrala commented 1 year ago

Windows is weird.

For me everything works as intended if I just run cargo bom and output to PowerShell or cmd.exe. However, if I pipe it to a file I can reproduce the issue.

I could fix the encoding issue if I pipe output to the following powershell command:

Out-File -FilePath $Env:temp\winbom.txt -Encoding oem