1
1
mirror of https://github.com/wader/fq.git synced 2024-11-23 09:56:07 +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:
Mattias Wadman 2023-05-16 11:02:03 +02:00 committed by GitHub
commit aec2635ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -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

Binary file not shown.

2
format/text/testdata/to_base64.fqtest vendored Normal file
View File

@ -0,0 +1,2 @@
$ fq '.uncompressed | to_base64' random.bin.gz -r
8Vr6cUH6erA=

2
format/text/testdata/to_hex.fqtest vendored Normal file
View File

@ -0,0 +1,2 @@
$ fq '.uncompressed | tohex' random.bin.gz -r
f15afa7141fa7ab0