PHP 8.2.31
Preview: iconvcharset.rb Size: 697 B
//proc/thread-self/root/opt/alt/ruby18/lib64/ruby/1.8/xsd/iconvcharset.rb

# XSD4R - Charset handling with iconv.
# Copyright (C) 2003  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.

# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.


require 'iconv'


module XSD


class IconvCharset
  def self.safe_iconv(to, from, str)
    iconv = Iconv.new(to, from)
    out = ""
    begin
      out << iconv.iconv(str)
    rescue Iconv::IllegalSequence => e
      out << e.success
      ch, str = e.failed.split(//, 2)
      out << '?'
      warn("Failed to convert #{ch}")
      retry
    end
    return out
  end
end


end

Directory Contents

Dirs: 2 × Files: 10

Name Size Perms Modified Actions
codegen DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
xmlparser DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
5.22 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
442 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
24.02 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
671 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
697 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.17 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.40 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
2.71 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.44 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.20 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).