Skip to content

bencode output strangeness #104

@mat813

Description

@mat813

When I send an integer value, it seems to be decoded correctly as it shows as a json number :

$ echo i12e | faq -f bencode -o json .
12

But when I ask that to be re-encoded as bencode, it gets translated into a string:

$ echo i12e | faq -f bencode -o bencode .
2:12
$ echo i12e | faq -f bencode -o bencode . | faq -f bencode -o json .
"12"

I do not speak go, so I am unsure wether the problem is here or in the bencode go library used by faq.

$ faq -v
github.com/jzelinskie/faq/cmd/faq version 0.0.7
	github.com/Azure/draft v0.16.0
	github.com/BurntSushi/toml v0.3.1
	github.com/alecthomas/chroma v0.8.2
	github.com/clbanning/mxj/v2 v2.5.5
	github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
	github.com/dlclark/regexp2 v1.2.0
	github.com/ghodss/yaml v1.0.0
	github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
	github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b
	github.com/jbrukh/bayesian v0.0.0-20200318221351-d726b684ca4a
	github.com/sirupsen/logrus v1.8.0
	github.com/spf13/cobra v1.1.3
	github.com/spf13/pflag v1.0.5
	github.com/zeebo/bencode v1.0.0
	golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
	golang.org/x/sys v0.0.0-20200413165638-669c56c373c4
	golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
	gopkg.in/yaml.v2 v2.4.0
	howett.net/plist v0.0.0-20201203080718-1454fab16a06

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions