handle file encoding ascii correctly
This commit is contained in:
9
bnn.go
9
bnn.go
@@ -6,6 +6,8 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/encoding/charmap"
|
||||
)
|
||||
|
||||
// Info Structure of headline
|
||||
@@ -145,6 +147,13 @@ func ReadBnn(r io.Reader) (Bnn, error) {
|
||||
for i, line := range lines {
|
||||
var item Item
|
||||
|
||||
// Encoding ASCII
|
||||
// Example file for ASCII was provided by Paxan
|
||||
// Extended ASCII has been used -> ä 132 \u0084
|
||||
if strings.Split(line, ";")[2] == "0" {
|
||||
line, _ = charmap.CodePage850.NewDecoder().String(line)
|
||||
}
|
||||
|
||||
col := strings.Split(line, ";")
|
||||
|
||||
// Headline contains infos
|
||||
|
||||
Reference in New Issue
Block a user