--from-file parameter NUL #172
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello,
I am working on a script that calls img2pdf to convert a bunch of files to pdf.
I would like to support filesnames with whitespaces. For this I tried different approaches quoting the filenames as positonal parameters and now I want to use the --from-file parameter and write the filesnames to a textfile.
However I don't know if am doing this right.
From my understanding the NUL is the ASCII Charater with Code 0. I tried to represent that char as \0 or `0 but that does not work.
Finally I piped the output of find -print0 to a textfile. And the Char that shows up as separator is "¿" inverted question mark. Thats definetly not the NUL char.
When I use that with img2pdf it works.
But I would like to understand why it works and if this really is the right way to do it?
Does someone have expirence using the --from-file parameter or can explain my observed behavior?
Thanks.
Correct.
What platform are you on? In what language are you trying to express a zero byte?
Where does it show up as an inverted question mark? This might just be the way in which whatever viewer you are using displays a null byte.
So it was a null byte after all, right? Can you confirm by looking at the hex dump of your input?
Using
find -print0
is one of the ways to do it.I need more information about what tools and what platform you are doing all of this with an on.
Thanks @josch for pointing me in the right direction.
I am on macOS 13 and I use Bash as well as PowerShell as Terminal/Scripting environment and BBEdit as Editor/Viewer.
You are absolutely right, BBEdit displays the NUL Char as ¿.
When I view the text file in Terminal via more is shows ^@ instead.
I also looked at a hex dump of the text file and it sure is 00.
In my powershell script I tried to use `0 as escape sequence for NUL in strings and it did not work when handing it to img2pdf as a cmdline parameter.
But when I write it to a text file and point img2pdf to that textfile with --from-file it works now.
So thanks again, this helped a lot.