instance method u_unpack

Ruby on Rails 3.1.12

Since v3.0.20 Last seen in v3.2.22.5

Available in: v3.0.20 v3.1.12 v3.2.22.5

Signature

u_unpack(string)

Unpack the string at codepoints boundaries. Raises an EncodingError when the encoding of the string isn’t valid UTF-8.

Example:

Unicode.u_unpack('Café') # => [67, 97, 102, 233]

Parameters

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

Defined in ActiveSupport::Multibyte::Unicode

Type at least 2 characters to search.

↑↓ navigate · open · esc close