handle file encoding ascii correctly
This commit is contained in:
parent
bd092d89dd
commit
335f5f2ac5
9
bnn.go
9
bnn.go
|
@ -6,6 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/text/encoding/charmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Info Structure of headline
|
// Info Structure of headline
|
||||||
|
@ -145,6 +147,13 @@ func ReadBnn(r io.Reader) (Bnn, error) {
|
||||||
for i, line := range lines {
|
for i, line := range lines {
|
||||||
var item Item
|
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, ";")
|
col := strings.Split(line, ";")
|
||||||
|
|
||||||
// Headline contains infos
|
// Headline contains infos
|
||||||
|
|
Loading…
Reference in New Issue