[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: How to convert hexacode in currency symbol ?
From: Eric Christopherson <echristopherson () gmail ! com>
Date: 2015-08-31 18:24:51
Message-ID: 20150831182451.GF25814 () gmail ! com
[Download RAW message or body]
On Mon, Aug 31, 2015, Frederic Branczyk wrote:
> Definitely. I thought OP meant to have the hex string as an input and
> expects the unicode symbol as an output. If the goal is simply the single
> symbol then I would prefer your answer.
Oh, right. In that case, one can also do
0x20b9.chr(Encoding::UTF_8)
in Ruby 2.2. I would have thought #chr without argument would assume
UTF-8 out of the box, but for me at least, it still only accepts 8-bit
values (ASCII-8BIT?)
>
> On Mon, Aug 31, 2015 at 8:15 PM, Eric Christopherson <
> echristopherson@gmail.com> wrote:
>
> > On Mon, Aug 31, 2015, Frederic Branczyk wrote:
> > > Have you tried something like this?
> > >
> > > ["20B9".to_i(16)].pack('U')
> > >
> > > On Mon, Aug 31, 2015 at 2:14 PM, Indrajeet Mishra <
> > > indrajeetmishra7590@gmail.com> wrote:
> > >
> > > > Hi All,
> > > >
> > > >
> > > > "20B9 " this is my hex Symbol, I want to convert this into a currency
> > > > Symbol but i dont know how?
> >
> > You could also use "\u20b9".
> >
> > --
> > Eric Christopherson
> >
--
Eric Christopherson
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic