How to create a tick in Unicode?

I would think it would be:

"✓".encode(:unicode) 

But I think this is the wrong use of .encode. And when I say:

 "✓".encode('Unicode') 

he cannot perform the conversion.

+6
source share
1 answer

If you are using Ruby 1.9 (which has much better native coding support), you can do this:

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

Source: https://habr.com/ru/post/887853/


All Articles