class method self.u_unpack

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available 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

string req
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 471
        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 471 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Multibyte::Chars

Type at least 2 characters to search.

↑↓ navigate · open · esc close