repo.or.cz
/
rbx.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Change soft-fail to use the config, rather than env
[rbx.git]
/
lib
/
rexml
/
encodings
/
SHIFT-JIS.rb
blob
93c7877afdbbc125c0cbb44aee8c4b2e3ad1614e
1
module REXML
2
module Encoding
3
begin
4
require 'uconv'
5
6
def decode_sjis content
7
Uconv::sjistou8(content)
8
end
9
10
def encode_sjis(str)
11
Uconv::u8tosjis(str)
12
end
13
rescue LoadError
14
require 'nkf'
15
16
SJISTOU8 = '-Swm0'
17
U8TOSJIS = '-Wsm0'
18
19
def decode_sjis(str)
20
NKF.nkf(SJISTOU8, str)
21
end
22
23
def encode_sjis content
24
NKF.nkf(U8TOSJIS, content)
25
end
26
end
27
28
b = proc do |obj|
29
class << obj
30
alias decode decode_sjis
31
alias encode encode_sjis
32
end
33
end
34
register("SHIFT-JIS", &b)
35
register("SHIFT_JIS", &b)
36
end
37
end