Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] wrong detect fields names #12

Open
flame0 opened this issue Dec 31, 2018 · 1 comment
Open

[Bug] wrong detect fields names #12

flame0 opened this issue Dec 31, 2018 · 1 comment

Comments

@flame0
Copy link
Contributor

flame0 commented Dec 31, 2018

For example when i am trying to get filed name, I expect to receive filed "REGN" in byte representation = [52 45 47 4E]. But i get something like "REGN�� u�O" [5245474E 00157505 4F].

@mygoodboy
Copy link

mygoodboy commented Jan 9, 2019

package main

import (
"fmt"
"github.com/LindsayBradford/go-dbf/godbf"
)

func main() {
// dbfTable, _ := godbf.NewFromFile("ChangeToYourDBF.dbf", "UTF8")
dbfTable, _ := godbf.NewFromFile("ChangeToYourDBF.dbf", "Big5")
FieldsName := dbfTable.FieldNames()

for i := 0; i < dbfTable.NumberOfRecords(); i++ {

	fmt.Printf("#%d", i)
	for j := 0; j < len(FieldsName); j++ {

		val, _ := dbfTable.FieldValueByName(i, FieldsName[j])
		fmt.Printf(" %s=%s ,", FieldsName[j], val)
	}
	fmt.Printf("\n")
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants