Method: RestfulController#unescape_unicode
- Defined in:
- lib/app/controllers/concerns/restful_controller.rb
#unescape_unicode(str) ⇒ Object
Convert UTF-8 unicode/escaped back to actual double byte character
22 23 24 25 26 |
# File 'lib/app/controllers/concerns/restful_controller.rb', line 22 def unescape_unicode(str) str.gsub(/\\u([\da-fA-F]{4})/) do |_m| [Regexp.last_match[1]].pack('H*').unpack('n*').pack('U*') end end |