How to read utf16 text file to string in golang?

The latest version of golang.org/x/text/encoding/unicode makes it easier to do this because it includes unicode.BOMOverride, which will intelligently interpret the BOM. Here is ReadFileUTF16(), which is like os.ReadFile() but decodes UTF-16. package main import ( “bytes” “fmt” “io/ioutil” “log” “strings” “golang.org/x/text/encoding/unicode” “golang.org/x/text/transform” ) // Similar to ioutil.ReadFile() but decodes UTF-16. Useful when // reading data … Read more

Print Directory & File Structure with icons for representation in Markdown [closed]

I followed an example in another repository and wrapped the directory structure within a pair of triple backticks (“`): “` project β”‚ README.md β”‚ file001.txt β”‚ └───folder1 β”‚ β”‚ file011.txt β”‚ β”‚ file012.txt β”‚ β”‚ β”‚ └───subfolder1 β”‚ β”‚ file111.txt β”‚ β”‚ file112.txt β”‚ β”‚ … β”‚ └───folder2 β”‚ file021.txt β”‚ file022.txt “`