Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1598

Show
Ignore:
Timestamp:
07/26/05 23:15:54 (3 years ago)
Author:
nahi
Message:

add iso-8859-1 converter. closes #106.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/xsd/charset.rb

    r1596 r1598  
    2525  EncodingConvertMap = {} 
    2626  def Charset.init 
     27    EncodingConvertMap[['UTF8', 'X_ISO8859_1']] = 
     28      Proc.new { |str| str.unpack('U*').pack('C*') } 
     29    EncodingConvertMap[['X_ISO8859_1', 'UTF8']] = 
     30      Proc.new { |str| str.unpack('C*').pack('U*') } 
    2731    begin 
    2832      require 'xsd/iconvcharset' 
     
    7074    'SJIS' => 'shift_jis', 
    7175    'UTF8' => 'utf-8', 
     76    'X_ISO_8859_1' => 'iso-8859-1', 
     77    'X_UNKNOWN' => nil, 
    7278  } 
    7379 
     
    114120  def Charset.charset_str(label) 
    115121    if CharsetMap.respond_to?(:key) 
    116       CharsetMap.key(label.downcase) 
     122      CharsetMap.key(label.downcase) || 'X_UNKNOWN' 
    117123    else 
    118       CharsetMap.index(label.downcase) 
     124      CharsetMap.index(label.downcase) || 'X_UNKNOWN' 
    119125    end 
    120126  end