Reputation: 11
\357' in expression
Invalid char
\273' in expression
Invalid char `\277' in expressionUpvotes: 0
Views: 2005
Reputation: 62648
If you're displaying this in a web browser, use the ®
or ®
HTML entities. The browser should interpret them as the correct character.
Upvotes: 0
Reputation: 186
You could also try Array#pack.
puts [174].pack('U*')
That won't require any non-ASCII characters in your source code.
Upvotes: 2
Reputation: 99921
You have to declare the source encoding:
# coding: utf-8
p "®"
(just add the # coding: utf-8
line in your file to declare its encoding to utf-8)
Upvotes: 1