开发者

How do I create a checkmark in unicode?

开发者 https://www.devze.com 2023-03-04 23:46 出处:网络
I would think it would be: \"✓\".encode(:unicode) But I think this is not the correct usage of .encode.And when I say:

I would think it would be:

"✓".encode(:unicode)

But I think this is not the correct usage of .encode. And when I say:

"✓".encode('Unicode')

it cannot do the conversion开发者_开发百科.


If you're using Ruby 1.9 (which has much better built-in encoding support), you can do this:

> checkmark = "\u2713"
# => "✓" 
> checkmark.encoding
# => #<Encoding:UTF-8> 
0

精彩评论

暂无评论...
验证码 换一张
取 消