Open peiqingyu opened 5 months ago
Bash is compiled as an ASCII program, so in order to work with ebcdic files, you need to tag it appropriately.
If you tag your file as EBCDIC, using chtag -tc 1047 input
do you get the expected result?
The other option is to set this environment variable:
export __UNTAGGED_READ_MODE=ASCII
always convert data from CCSID 1047 to CCSID 819
The input is an ASCII file which is untagged and I expect to get its ASCII content in my Go program. In our actual case, the input file is a tarball and it is untagged. I expect the Go program to read the tarball in stdin and then extract the content correctly. I tested the following scenarios with bash: $ cat tarball | go-program --- doesn't work $ go-program < <(cat tarball) --- doesn't work $ go-program <tarball --- works well Only the third redirection method works for my case. Why the other two methods do not work? Is it possible to make them work? It seems the tarball is converted from 1047 to 819 by bash for the first two methods. Thanks.
I have an input file which is untagged and its content is ascii characters "abc".
And I have a Go program named main which reads data from stdin and prints the data in hex. $ cat input | main input is: 2fefbfbdc48e
I expected got "6162630a" which is "abc\n" in hex. It seems bash does a conversation from 819 to 1047. On my test system, _BPXK_AUTOCVT is set to "On". I am confused about the behavior. Any thought? If the input file is tagged with 819 I got the expected output. $ chtag -p input 6162630a