class ElasticAPM::Sql::Tokenizer

def peek_char(length = 1)

multi-byte character
StringScanner#peek returns next byte which could be an incomplete utf
def peek_char(length = 1)
  # The maximum byte count of utf chars is 4:
  # > In UTF-8, characters from the U+0000..U+10FFFF range (the UTF-16
  #   accessible range) are encoded using sequences of 1 to 4 octets.
  # # https://tools.ietf.org/html/rfc3629
  return nil if length > 4
  char = @scanner.peek(length)
  return nil if char.empty?
  return char if char.valid_encoding?
  peek_char(length + 1)
end