From: Paul Date: 2008-05-30T16:49:52+09:00 Subject: Re: how to generate ascii code? On May 30, 4:32 pm, dare ruby wrote: > Dear all, > > Iam in process of building a parser. I need to convert the numeric > character reference to corresponding ascii. > > when numeric character reference like L or ÿ is given i need > to convert those into corresponding ascii. consider character reference > like L my parser will read character by character and eliminate &#; > and store '76' alone in a string variable (temp), so now temp = '76', i > need to generate its corresponding ascii value 'L'. please help me to > the process > > example: WEL after ASCII code conversion it should be WELCOME as > for 76 corresponding ascii value is 'L'. > > Like wise consider the second example ÿ > > now temp = 00ff it should also generate its corresponding ascii code. > > in both cases even if its a decimal value or hexa decimal value its > is stored as string in my process. As iam reading character by character > from buffer and adding each character to temp string. > > so please help me to solve this issue.. > > Thanks in advance... > > Regards, > Jose Martin > -- > Posted viahttp://www.ruby-forum.com/. '76'.to_i.chr