lib/sensu/client/socket.rb
def valid_utf8?(data)
        utf8_string_pattern = /\A([\x00-\x7f]|
                                  [\xc2-\xdf][\x80-\xbf]|
                                  \xe0[\xa0-\xbf][\x80-\xbf]|
                                  [\xe1-\xef][\x80-\xbf]{2}|
                                  \xf0[\x90-\xbf][\x80-\xbf]{2}|
                                  [\xf1-\xf7][\x80-\xbf]{3})*\z/nx
        data = data.force_encoding('BINARY') if data.respond_to?(:force_encoding)
        return data =~ utf8_string_pattern
      end
# Tests if the argument (data) is a valid UTF-8 sequence.
#
# @param [String] data to be tested.
Tests if the argument (data) is a valid UTF-8 sequence.
Tests if the argument ( data ) is a valid UTF - 8 sequence .
def valid_utf8?(data)
        utf8_string_pattern = /\A([\x00-\x7f]|
                                  [\xc2-\xdf][\x80-\xbf]|
                                  \xe0[\xa0-\xbf][\x80-\xbf]|
                                  [\xe1-\xef][\x80-\xbf]{2}|
                                  \xf0[\x90-\xbf][\x80-\xbf]{2}|
                                  [\xf1-\xf7][\x80-\xbf]{3})*\z/nx
        data = data.force_encoding('BINARY') if data.respond_to?(:force_encoding)
        return data =~ utf8_string_pattern
      end
def valid_utf8? ( data ) utf8_string_pattern = / \A ([ \x00 - \x7f ]|
                                  [ \xc2 - \xdf ][ \x80 - \xbf ]|
                                   \xe0 [ \xa0 - \xbf ][ \x80 - \xbf ]|
                                  [ \xe1 - \xef ][ \x80 - \xbf ]{2}|
                                   \xf0 [ \x90 - \xbf ][ \x80 - \xbf ]{2}|
                                  [ \xf1 - \xf7 ][ \x80 - \xbf ]{3})* \z /nx data = data . force_encoding ( 'BINARY' ) if data . respond_to? ( :force_encoding ) return data =~ utf8_string_pattern end
Tests if the argument (data) is a valid UTF-8 sequence.
Tests if the argument ( data ) is a valid UTF - 8 sequence .
data
data to be tested.
data to be tested .