Sha256: 1815b35de28e3410e552c84cf2e6cfc15e15a1b02f42149d59c5daa3203bcf99
Contents?: true
Size: 964 Bytes
Versions: 9
Compression:
Stored size: 964 Bytes
Contents
# # setup default OCI encoding from NLS_LANG. # # try to get NLS_LANG. nls_lang = ENV['NLS_LANG'] if defined? OCI8::Win32Util dll_path = OCI8::Win32Util.dll_path.upcase if dll_path =~ %r{\\BIN\\OCI.DLL} oracle_home = $` OCI8::Win32Util.enum_homes do |home, lang| if oracle_home == home.upcase nls_lang = lang break end end end end if nls_lang # Extract character set name from NLS_LANG. if nls_lang =~ /\.([[:alnum:]]+)$/ charset = $1.upcase else raise "Invalid NLS_LANG format: #{nls_lang}" end # Convert the Oracle character set name to Ruby encoding name by # querying the yaml data. require 'yaml' enc = YAML::load_file(File.dirname(__FILE__) + '/encoding.yml')[charset] if enc.nil? raise "Ruby encoding name is not found in encoding.yml for NLS_LANG #{nls_lang}." end else warn "Warning: NLS_LANG is not set. fallback to US-ASCII." enc = 'US-ASCII' end OCI8.encoding = enc
Version data entries
9 entries across 9 versions & 1 rubygems