> [65].pack('c')
=> "A"
In the above case 65 is stored as 1000 0010. Since c returns 8-bit unsigned char the returned value is 65 which happens to be the ASCII code for A.
I do not get the result of following two operations. Any explanations would help.
> ['A'].pack('H')
=> "\xA0"
> ['A'].pack('h')
=> "\n"
If you read the documentation you find this:
I don’t know why you’d need to flip nibbles, but the facility is there if you need it.
In your case
Ais being interpreted asA0one way, and0Ain the other. Hex input should be provided as character pairs.