def check_utf(text)
      return if text.nil?
      results = { text: text, encoded: nil, wchar: nil, error: nil }

      begin
        if !text.valid_encoding?
          encoded = text.chars.select(&:valid_encoding?).join
          encoded.delete!('_')
          encoded = encoded.delete("^\u{0000}-\u{007F}")
        else
          encoded = text.delete("^\u{0000}-\u{007F}")
        end
        wchar = encoded&.gsub(/\s+/, ' ')&.strip
        results[:encoded] = encoded if text != encoded
        results[:wchar] = wchar if encoded != wchar
      rescue StandardError => error
        results[:error] = error.message if error
      end
      results
    end
def check_utf(text)
      return if text.nil?
      results = { text: text, encoded: nil, wchar: nil, error: nil }

      begin
        if !text.valid_encoding?
          encoded = text.chars.select(&:valid_encoding?).join
          encoded.delete!('_')
          encoded = encoded.delete("^\u{0000}-\u{007F}")
        else
          encoded = text.delete("^\u{0000}-\u{007F}")
        end
        wchar = encoded&.gsub(/\s+/, ' ')&.strip
        results[:encoded] = encoded if text != encoded
        results[:wchar] = wchar if encoded != wchar
      rescue StandardError => error
        results[:error] = error.message if error
      end
      results
    end
* CHECK UTF *