本文简要介绍ruby语言中  Encoding::UndefinedConversionError.error_char  的用法。
用法
error_char → string返回导致  Encoding::UndefinedConversionError  的 one-character 字符串。
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP")
begin
  ec.convert("\xa0")
rescue Encoding::UndefinedConversionError
  puts $!.error_char.dump   #=> "\xC2\xA0"
  p $!.error_char.encoding  #=> #<Encoding:UTF-8>
end相关用法
- Ruby UndefinedConversionError.source_encoding用法及代码示例
- Ruby UnboundMethod.original_name用法及代码示例
- Ruby UnboundMethod.bind用法及代码示例
- Ruby UncaughtThrowError类用法及代码示例
- Ruby UnwindDetails.all_requirements用法及代码示例
- Ruby UnboundMethod类用法及代码示例
- Ruby UnwindDetails.reversed_requirement_tree_index用法及代码示例
- Ruby UnboundMethod.parameters用法及代码示例
- Ruby UnboundMethod.inspect用法及代码示例
- Ruby UncaughtThrowError.new用法及代码示例
- Ruby UnwindDetails.unwinding_to_primary_requirement?用法及代码示例
- Ruby UnpackCommand.get_path用法及代码示例
- Ruby UnwindDetails.sub_dependencies_to_avoid用法及代码示例
- Ruby UnboundMethod.to_s用法及代码示例
- Ruby UnboundMethod.owner用法及代码示例
- Ruby UnboundMethod.clone用法及代码示例
- Ruby UnboundMethod.arity用法及代码示例
- Ruby URI.parse用法及代码示例
- Ruby UID.change_privilege用法及代码示例
- Ruby Util.unescape用法及代码示例
- Ruby Util.url_encode用法及代码示例
- Ruby UNIXSocket.new用法及代码示例
- Ruby UNIXSocket.addr用法及代码示例
- Ruby URI模块用法及代码示例
- Ruby UNIXServer.accept用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 UndefinedConversionError.error_char。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
