Returns a string description of the character that caused an
 `Encoding::UndefinedConversionError`.

 @param e [Encoding::UndefinedConversionError]
 @return [String]
186637
def undefined_conversion_error_char(e)
      # Rubinius (as of 2.0.0.rc1) pre-quotes the error character.
      return e.error_char if rbx?
      # JRuby (as of 1.7.2) doesn't have an error_char field on
      # Encoding::UndefinedConversionError.
      return e.error_char.dump unless jruby?
      e.message[/^"[^"]+"/] # "
    end
422152
def _codec_error_url_quote(e):
    
    out = _fast_url_quote(e.object[e.start : e.end])

    if PY2:
        out = out.decode("utf-8")

    return out, e.end
462200
def text_to_utf8 text
      unless text.valid_encoding? and text.encoding == "UTF-8"
        # TODO: had some ruby 1.9 problems with rchardet ... but ideally it or a similar functionality will be reintroduced
        source_encoding = text.valid_encoding? ? text.encoding : "US-ASCII"
        text = text.encode('UTF-8', source_encoding, {:invalid=>:replace, :undef=>:replace, :replace=>""})
        text = text.gsub("\u0000","") # TODO: this cleanup of nil values isn't supposed to be needed...
      end
      text
    end
536248
def encodingStrings( reverse = false )
      @encodingStrings  = [ {"&" => "&amp;" },  {"<" => "&lt;"} , {">" => "&gt;"}, {"'" => "&apos;"}, {"\"" => "&quot;" }  ] if @encodingStrings.nil?
      if block_given?
         if reverse
            @encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
         else
            @encodingStrings.each{ |s| s.each{|k,v| yield k,v }  }
         end
      else
         @encodingStrings
      end
   end
60982
public static EncodingException createEncodingException(
			final ErrorKeys errorId, final String message, final Exception e)
	{

		return new EncodingException(errorId.toString() + ":\r\n" + message, e);
	}
282701
function (e) {
            var str = "";

            if (typeof e == 'undefined' || e == null) {
                return str;
            }

            str = "\nException";
            str += "\n" + '---------------------------------------------------';
            if (e.fileName)
                str += '\nFile: ' + e.fileName;
            if (e.lineNumber)
                str += '\nLine: ' + e.lineNumber;
            if (e.message)
                str += '\nMessage: ' + e.message;
            if (e.name)
                str += '\nError: ' + e.name;
            if (e.stack)
                str += '\nStack:' + "\n" + e.stack.substring(0, 200) + " [...] Truncated stacktrace.";
            str += "\n" + '---------------------------------------------------' + "\n";

            return str;
        }
625106
function _convertUnicode(originalStr) {
  let m;
  let c;
  let cStr;
  let lastI = 0;

  // Matches \u#### but not \\u####
  const unicodeRegex = /\\u[0-9a-fA-F]{4}/g;

  let convertedStr = '';
  while ((m = unicodeRegex.exec(originalStr))) {
    // Don't convert if the backslash itself is escaped
    if (originalStr[m.index - 1] === '\\') {
      continue;
    }

    try {
      cStr = m[0].slice(2); // Trim off start
      c = String.fromCharCode(parseInt(cStr, 16));
      if (c === '"') {
        // Escape it if it's double quotes
        c = `\\${c}`;
      }

      // + 1 to account for first matched (non-backslash) character
      convertedStr += originalStr.slice(lastI, m.index) + c;
      lastI = m.index + m[0].length;
    } catch (err) {
      // Some reason we couldn't convert a char. Should never actually happen
      console.warn('Failed to convert unicode char', m[0], err);
    }
  }

  // Finally, add the rest of the string to the end.
  convertedStr += originalStr.slice(lastI, originalStr.length);

  return convertedStr;
}
1251458
def parse!
      begin
        parse
      rescue StandardError => e
        raise e if @options[:trace] || e.is_a?(SystemExit)
        $stderr.puts "#{e.class}: " + e.message.to_s
        exit 1
      end
      exit 0
    end
2762
def normalized_fragment
      return nil unless self.fragment
      return @normalized_fragment if defined?(@normalized_fragment)
      @normalized_fragment ||= begin
        component = Addressable::URI.normalize_component(
          self.fragment,
          Addressable::URI::CharacterClasses::FRAGMENT
        )
        component == "" ? nil : component
      end
      # All normalized values should be UTF-8
      if @normalized_fragment
        @normalized_fragment.force_encoding(Encoding::UTF_8)
      end
      @normalized_fragment
    end
1173988
def handle_decode_replace(e):
    
    count = e.end - e.start
    #return "." * count, e.end

    global ENCODING_REPLACE_CHAR
    return ENCODING_REPLACE_CHAR * count, e.end
540217
def decodeRPCErrorMsg(e):
    
    found = re.search(
        (
            "(10 assert_exception: Assert Exception\n|"
            "3030000 tx_missing_posting_auth)"
            ".*: (.*)\n"
        ),
        str(e),
        flags=re.M,
    )
    if found:
        return found.group(2).strip()
    else:
        return str(e)
385231
def unicode_char(ignored_chars=None):
        """"""
        return lambda e: e.unicode if e.type == pygame.KEYDOWN \
            and ((ignored_chars is None) 
                  or (e.unicode not in ignored_chars))\
            else EventConsumerInfo.DONT_CARE
809621
public char getDelimiterEscapeChar(char ch) throws DefinitionException {
      if (ch == 'E')
        return escapeCharacter;
      else if (ch == 'F')
        return fieldDelimiter;
      else if (ch == 'S')
        return componentDelimiter;
      else if (ch == 'T')
        return subComponentDelimiter;
      else if (ch == 'R')
        return repetitionDelimiter;
      else
        throw new DefinitionException("internal error in getDelimiterEscapeChar");
    }
345853
def character(code_point_or_name)
      if code_point_or_name.is_a?(Symbol)
        require "erector/unicode"
        found = Erector::CHARACTERS[code_point_or_name]
        if found.nil?
          raise "Unrecognized character #{code_point_or_name}"
        end
        raw("&#x#{sprintf '%x', found};")
      elsif code_point_or_name.is_a?(Integer)
        raw("&#x#{sprintf '%x', code_point_or_name};")
      else
        raise "Unrecognized argument to character: #{code_point_or_name}"
      end
    end
250730
def unescape_unreserved(input)
      input.gsub(/%([a-f\d]{2})/i) do |encoded|
        decoded = $1.hex.chr

        if decoded =~ UNRESERVED_OR_UTF8
          decoded
        else
          encoded
        end
      end
    end
1039718
private static String decodeString(ByteBuffer src) throws CharacterCodingException
    {
        // the decoder needs to be reset every time we use it, hence the copy per thread
        CharsetDecoder theDecoder = decoder.get();
        theDecoder.reset();

        final CharBuffer dst = CharBuffer.allocate(
                (int) ((double) src.remaining() * theDecoder.maxCharsPerByte()));

        CoderResult cr = theDecoder.decode(src, dst, true);
        if (!cr.isUnderflow())
            cr.throwException();

        cr = theDecoder.flush(dst);
        if (!cr.isUnderflow())
            cr.throwException();

        return dst.flip().toString();
    }
1209072
def character_to_vk(self, character):
        
        for vk in self.non_layout_keys:
            if self.non_layout_keys[vk] == character.lower():
                return (vk, [])
        for vk in self.layout_specific_keys:
            if self.layout_specific_keys[vk][0] == character:
                return (vk, [])
            elif self.layout_specific_keys[vk][1] == character:
                return (vk, ['shift'])
        raise ValueError("Unrecognized character: {}".format(character))