# Re: character to hex/binary/etc

**URL:** <https://www.ruby-forum.com/t/re-character-to-hex-binary-etc/112265>\
**Category:** Ruby\
**Created:** [August 16, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/re-character-to-hex-binary-etc/112265 "2007-08-16T22:35:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [August 16, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/re-character-to-hex-binary-etc/112265/1 "2007-08-16T22:35:10Z")

</div>

> Oops, no, that’s not what I need. I can do that.  
> I need to take “I” or “J” or whatever character and convert to hex!  
> or binary

irb(main):001:0\> “I”[0]  
=\> 73  
irb(main):002:0\> “I”[0].to\_s(16)  
=\> “49”
