It if is a hex string, then it is not a string, you are just looking at
it as a string You ‘might’ handle it as a string, but in this case
you mix Unicode and non-Unicode characters in it (if we try to treat
each byte or multi-byte as a character).
So even if I force the encoding of UTF-8, it will fail (\xaa is not a
valid Unicode character)
one question from out of curiosity - How did you got to know, by looking
at the final Array or string, that “616263” is actually “abc” ?
Practice. After a few years of hexdumping and byte scanning, values like
31,32,33 and 41,42,43 and 61,62,63 start to leap out at you. You also
get used to scanning for 20 and 0A (or 0D0A).
one question from out of curiosity - How did you got to know, by looking
at the final Array or string, that “616263” is actually “abc” ?
Practice. After a few years of hexdumping and byte scanning, values like
31,32,33 and 41,42,43 and 61,62,63 start to leap out at you. You also
get used to scanning for 20 and 0A (or 0D0A).
Exactly
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.