mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* rename 'Shift-JIS' to 'SHIFT-JIS'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28595a72a9
commit
0f33529f63
4 changed files with 18 additions and 33 deletions
1
lib/rexml/encodings/SHIFT-JIS.rb
Normal file
1
lib/rexml/encodings/SHIFT-JIS.rb
Normal file
|
@ -0,0 +1 @@
|
|||
require 'rexml/encodings/SHIFT_JIS'
|
17
lib/rexml/encodings/SHIFT_JIS.rb
Normal file
17
lib/rexml/encodings/SHIFT_JIS.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
begin
|
||||
require 'uconv'
|
||||
|
||||
module REXML
|
||||
module Encoding
|
||||
def to_shift_jis content
|
||||
Uconv::u8tosjis(content)
|
||||
end
|
||||
|
||||
def from_shift_jis(str)
|
||||
Uconv::sjistou8(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
raise "uconv is required for Japanese encoding support."
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
begin
|
||||
require 'uconv'
|
||||
|
||||
module REXML
|
||||
module Encoding
|
||||
def from_shift_jis(str)
|
||||
Uconv::u8tosjis(content)
|
||||
end
|
||||
|
||||
def to_shift_jis content
|
||||
Uconv::sjistou8(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
begin
|
||||
require 'iconv'
|
||||
module REXML
|
||||
module Encoding
|
||||
def from_shift_jis(str)
|
||||
return Iconv::iconv("utf-8", "shift-jis", str).join
|
||||
end
|
||||
|
||||
def to_shift_jis content
|
||||
return Iconv::iconv("shift-jis", "utf-8", content).join
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
raise "uconv or iconv is required for Japanese encoding support."
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
require 'rexml/encodings/Shift-JIS'
|
Loading…
Reference in a new issue