mirror of
https://github.com/wader/fq.git
synced 2024-12-26 06:51:35 +03:00
Merge pull request #672 from Rogach/pr/fix-tohex
fix to_hex function handling of non-ascii characters
This commit is contained in:
commit
aec2635ea6
@ -31,7 +31,7 @@ func init() {
|
||||
}
|
||||
return bb
|
||||
})
|
||||
interp.RegisterFunc0("to_hex", func(_ *interp.Interp, c string) any {
|
||||
interp.RegisterFunc0("to_hex", func(_ *interp.Interp, c any) any {
|
||||
br, err := interp.ToBitReader(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -73,7 +73,7 @@ func init() {
|
||||
type toBase64Opts struct {
|
||||
Encoding string
|
||||
}
|
||||
interp.RegisterFunc1("_to_base64", func(_ *interp.Interp, c string, opts toBase64Opts) any {
|
||||
interp.RegisterFunc1("_to_base64", func(_ *interp.Interp, c any, opts toBase64Opts) any {
|
||||
br, err := interp.ToBitReader(c)
|
||||
if err != nil {
|
||||
return err
|
||||
|
BIN
format/text/testdata/random.bin.gz
vendored
Normal file
BIN
format/text/testdata/random.bin.gz
vendored
Normal file
Binary file not shown.
2
format/text/testdata/to_base64.fqtest
vendored
Normal file
2
format/text/testdata/to_base64.fqtest
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
$ fq '.uncompressed | to_base64' random.bin.gz -r
|
||||
8Vr6cUH6erA=
|
2
format/text/testdata/to_hex.fqtest
vendored
Normal file
2
format/text/testdata/to_hex.fqtest
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
$ fq '.uncompressed | tohex' random.bin.gz -r
|
||||
f15afa7141fa7ab0
|
Loading…
Reference in New Issue
Block a user