Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search.
According to this , you need to use 'cp' for decoding, example:. As this method is not taking any "decode" parameter to decode it properly, it just creates a "readable" string for printing purposes.
This does not mean it is actually a ' '. I just uses that character when printing. It is still a bytearray, not a string.
Python always tries to first decode hex as a printable read: ASCII character when printing via print. If you need a full hex string printed use binascii. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 3 years, 10 months ago. Active 3 years, 10 months ago. Viewed 1k times. So I guess my question is how can I get python to print the byte object as 'x40' instead of ' ' Thank you so much for your help :.
Or iconv :. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 1 year, 8 months ago. Active 1 year, 8 months ago. Viewed 1k times. Improve this question. Ameer Ameer 23 3 3 bronze badges. Do you have iconv or recode commands?
I have iconv and tried using this. But it is still giving unreadable data after conversion. I dont have recode in my unix — Ameer. Please show the exact iconv command you used and tell us what exactly means "unreadable data". What are the character encodings before and after the conversion? I just claimed that Linux was a natural vehicle for dealing with this kind of problem, so I thought I should show some work.
If you look at my profile on IT ToolBox, you might figure out a better way of communicating with me. While I was playing with the problem, I came across a couple of considerations that were not immediately obvious.
Values are available in two entirely different ways. Firstly, when used for communication over unreliable devices like serial interfaces , the top bit is used to hold parity so single-bit errors can be detected. The actual ASCII code definitions are duplicated in the upper set, so the characters are independent of their parity.
Multiple code pages can be swapped in, for non-English alphabets, math symbols, block graphics, and other requirements. That is not precisely true. But that involves data loss — you could never make the backward translation because it could be to either quote type. But most of the codes are IBM-specific: e. I noted that the dd command does translation in both directions. That worked exactly, which is comforting.
Additional programming for your specific data would be relatively simple. I will post my code, and the results, soon.
This is the automatically generated mapping table in reference format, as 4 columns. Each column has three values:. The big deal here is that most SQL-type actions need the whole thing to be repeated copy-paste style for every individual column required, which is a cause of errors and expense. Procedural languages like awk allow common functionality to be shared across many column objects. One is glad to be of service. I also came up with a couple of new tricks that I can use in the future.
I thought this was just curiosity on my part, but it turned out that it could be important for your conversion in some area.
Missed one crucial word. My particular near-paranoid interest in this translation problem is that I have a bunch of Linux tar archives, containing data from Windows NTFS partitions, totaling about , files per archive. An awful lot of the Windows files have UTF-8 filenames e. The Linux representation of those names in the Table of Contents uses an entirely different escaped representation, which has changed several times this year I think because my Linux updates have updated their Locale definitions or added new ones.
Think I have it licked now, though. There is usually no need for any complex conversion routine when processing EBCDIC data in Ab Initio, but it does depend on exactly how the data has been encoded on the mainframe.
No Account? Sign up. By signing in, you agree to our Terms of Use and Privacy Policy. Already have an account? Sign in. By signing up, you agree to our Terms of Use and Privacy Policy.
Enter the email address associated with your account. We'll send a magic link to your inbox. Email Address. All Sign in options. Enter a Email Address. Choose your interests Get the latest news, expert insights and market research, sent straight to your inbox.
Newsletter Topics Select minimum 1 topic.
0コメント