Constructing a string from hex value

[0x2a, 0x7e, 0x0a, 0x7e].pack("C*") => "*~\n~"



This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.


-----Original Message-----
From: Srdjan Marinovic []
Sent: Wednesday, September 06, 2006 8:05 AM
To: ruby-talk ML
Subject: constructing a string from hex value


How do I construct a string out of hex values?
In other words I want to give exact hex value for each byte
in the string. So I would have soemthing like

0x2a, 0x7e, 0x0a, 0x7e

If I go through Fixnum I get my string to contain numbers 48,
115, 10, 115 but I do not want that but rather a string of
ASCII(48), ACII(115),...