class method
self.u_unpack
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
self.u_unpack(string)
Unpack the string at codepoints boundaries. Raises an EncodingError when the encoding of the string isn’t valid UTF-8.
Example:
Chars.u_unpack('Café') #=> [67, 97, 102, 233]
Parameters
-
stringreq
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 444
def u_unpack(string)
begin
string.unpack 'U*'
rescue ArgumentError
raise EncodingError, 'malformed UTF-8 character'
end
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 444
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars