iconv:iconv 包装器

  • e0_451929
    了解作者
  • 20.9KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-06 07:53
    上传日期
图标 iconv 包装器,曾经是 ext/iconv 抽象的 Iconv 是 UNIX 95 iconv()函数系列的包装类,用于在各种编码系统之间转换字符串。 有关更多详细信息,请参阅 Open Group 的在线文档。 iconv.h : iconv_open() : iconv() : iconv_close() : 可用的编码系统取决于平台。 安装 将此行添加到应用程序的 Gemfile 中: gem 'iconv' 然后执行: $ bundle 或者自己安装: $ gem install iconv 用法 两个字符集之间的简单转换。 converted_text = Iconv . conv ( 'iso-8859-15' , 'utf-8' , text ) 实例化一个新的Iconv并使用方法Iconv#iconv 。 cd = Iconv .
iconv-master.zip
  • iconv-master
  • lib
  • iconv
  • version.rb
    36B
  • iconv.rb
    93B
  • test
  • test_option.rb
    1.1KB
  • utils.rb
    561B
  • test_partial.rb
    1.6KB
  • test_basic.rb
    1.9KB
  • ext
  • iconv
  • charset_alias.rb
    2.4KB
  • iconv.c
    33.2KB
  • mkwrapper.rb
    1.3KB
  • extconf.rb
    1.8KB
  • LICENSE.txt
    2.4KB
  • Gemfile
    286B
  • Rakefile
    1.1KB
  • .travis.yml
    207B
  • README.md
    2.1KB
  • .gitignore
    196B
  • iconv.gemspec
    792B
  • BSDL
    1.3KB
内容介绍
# Iconv [![Build Status](https://travis-ci.org/ruby/iconv.svg)](https://travis-ci.org/ruby/iconv) iconv wrapper, used to be ext/iconv ## Abstract Iconv is a wrapper class for the UNIX 95 <code>iconv()</code> function family, which translates string between various encoding systems. See Open Group's on-line documents for more details. * <code>iconv.h</code>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html * <code>iconv_open()</code>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_open.html * <code>iconv()</code>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html * <code>iconv_close()</code>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_close.html Which coding systems are available is platform-dependent. ## Installation Add this line to your application's Gemfile: ```ruby gem 'iconv' ``` And then execute: $ bundle Or install it yourself as: $ gem install iconv ## Usage 1. Simple conversion between two charsets. ```ruby converted_text = Iconv.conv('iso-8859-15', 'utf-8', text) ``` 2. Instantiate a new `Iconv` and use method `Iconv#iconv`. ```ruby cd = Iconv.new(to, from) begin input.each { |s| output << cd.iconv(s) } output << cd.iconv(nil) # Don't forget this! ensure cd.close end ``` 3. Invoke `Iconv.open` with a block. ```ruby Iconv.open(to, from) do |cd| input.each { |s| output << cd.iconv(s) } output << cd.iconv(nil) end ``` 4. Shorthand for (3). ```ruby Iconv.iconv(to, from, *input.to_a) ``` ## Attentions Even if some extensions of implementation dependent are useful, DON'T USE those extensions in libraries and scripts to widely distribute. If you want to use those feature, use `String#encode`. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ## License Ruby License/2-clause BSDL
评论
    相关推荐
    • UNIX UNLEASHED
      经典的UNIX教材 UNIX UNLEASHED Sams Development Team SAMS Publishibng 201 West 103rd Street, Indianapolis, IN 46290
    • Unix
      Unix
    • Unix Tutorial
      清华大学UNIX教程讲义PPT<br>适合初学者
    • Unix Tutorial
      清华大学UNIX教程讲义PPT<br>适合初学者
    • Unix时间戳
      Unix时间戳计算方法,看完就可以自己订制属于自己的VB时间戳了
    • UNIX
      UNIX课程幻灯片
    • Unix递归
      Unix递归 快速执行递归文件系统操作的功能。 $ stack run unix-recursive-bin -- ${path-to-directory}
    • lions unix
      莱昂氏unix源码pdf,或代码获取网址,及对应的英汉注释的书。下载,请评论。
    • unix unix
      unixunixunixunixunix
    • Unix
      Unix