Skip to content

Commit

Permalink
EUC-JP -> UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
okkez committed May 29, 2012
1 parent 70f61b7 commit 701fe9b
Show file tree
Hide file tree
Showing 24 changed files with 122 additions and 44 deletions.
2 changes: 1 addition & 1 deletion bin/refe
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $LOAD_PATH.unshift((bindir + '../lib').realpath)

unless defined?(::Encoding)
# Ruby 1.8
$KCODE = 'EUC'
$KCODE = 'UTF-8'
end

require 'bitclust/searcher'
Expand Down
4 changes: 2 additions & 2 deletions config.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@bc_srcdir = @bc_cgidir

def setup_environment
$KCODE = 'EUC' unless Object.const_defined?(:Encoding)
$KCODE = 'UTF-8' unless Object.const_defined?(:Encoding)
$LOAD_PATH.unshift "#{@bc_srcdir}/lib"
require 'bitclust'
end
Expand All @@ -17,7 +17,7 @@ def bitclust_context
manager = BitClust::ScreenManager.new(
:baseurl => "#{@bc_urlroot}/refm/api/view",
:datadir => "#{@bc_srcdir}/data/bitclust",
:encoding => 'euc-jp'
:encoding => 'utf-8'
)
BitClust::RequestHandler.new(db, manager)
end
2 changes: 1 addition & 1 deletion config.ru.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ app = BitClust::App.new(
:baseurl => 'http://localhost:9292',
:dbpath => Dir.glob('db-*'),
:datadir => File.join(a, 'data', 'bitclust'),
:encoding => 'euc-jp',
:encoding => 'utf-8',
:viewpath => '/view',
:rack => true
)
Expand Down
78 changes: 78 additions & 0 deletions data/bitclust/catalog/ja_JP.UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Abstract
要約
Added Methods
追加されるメソッド
Added/Redefined Methods
追加・再定義されるメソッド
All Classes
クラス一覧
All Functions
関数一覧
All Libraries
ライブラリ一覧
Builtin Library
組み込みライブラリ
Classes
クラス
Class Index
クラス一覧
Classes/Modules
クラスとモジュール
Constants
定数
Description
説明
Entry
エントリ
Exception Classes
例外クラス
Function Index
関数一覧
Inherited Methods
継承したメソッド
Instance Methods
インスタンスメソッド
Library
ライブラリ
Library Index
ライブラリ一覧
Method
メソッド
Modules
モジュール
Module Functions
モジュール関数
Objects
オブジェクト
Private Instance Methods
privateメソッド
Private Singleton Methods
private特異メソッド
Required Libraries
同時にrequireされるライブラリ
%d Results
%d件ヒット
Ruby %s Reference Manual
Ruby %s リファレンスマニュアル
Search
検索
Search Results
検索結果
Signature
定義
Singleton Methods
特異メソッド
Special Variables
特殊変数
Sub-Libraries
サブライブラリ
ancestors
クラスの継承リスト
class %s
%sクラス
library %s
%sライブラリ
module %s
%sモジュール
object %s
%sオブジェクト
2 changes: 1 addition & 1 deletion data/bitclust/template.lillia/library
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<%
headline_init
%>
<%= headline(@entry.id == '_builtin' ? '�Ȥ߹��ߥ饤�֥��' : "library #{@entry.name}") %>
<%= headline(@entry.id == '_builtin' ? '組み込みライブラリ' : "library #{@entry.name}") %>

<%
headline_push
Expand Down
6 changes: 3 additions & 3 deletions lib/bitclust/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(options)
dbpath = options[:dbpath]
baseurl = options[:baseurl] || ''
datadir = options[:datadir] || File.expand_path('../../data/bitclust', File.dirname(__FILE__))
encoding = options[:encoding] || 'euc-jp'
encoding = options[:encoding] || 'utf-8'
viewpath = options[:viewpath]
capi = options[:capi]
if options[:rack]
Expand Down Expand Up @@ -115,13 +115,13 @@ def service(req, res)
raise WEBrick::HTTPStatus::NotFound
end
res.body = index(req)
res['Content-Type'] = 'text/html; charset=euc-jp'
res['Content-Type'] = 'text/html; charset=utf-8'
end

def call(env)
[
200,
{'Content-Type' => 'text/html; charset=euc-jp'},
{'Content-Type' => 'text/html; charset=utf-8'},
index(Rack::Request.new(env))
]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def makepath(rel)

def load_properties(rel)
h = {}
fopen(realpath(rel), 'r:EUC-JP') {|f|
fopen(realpath(rel), 'r:UTF-8') {|f|
while line = f.gets
k, v = line.strip.split('=', 2)
break unless k
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/functionreferenceparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(db)
end

def parse_file(path, filename, properties)
fopen(path, 'r:EUC-JP') {|f|
fopen(path, 'r:UTF-8') {|f|
return parse(f, filename)
}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/messagecatalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def MessageCatalog.find_catalog(prefix, locales)

def MessageCatalog.load_file(path, locale)
h = {}
fopen(path, 'r:EUC-JP') {|f|
fopen(path, 'r:UTF-8') {|f|
f.each do |key|
h[key.chomp] = f.gets.chomp
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/methoddatabase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def update_by_stdlibtree(root)
end

def parse_LIBRARIES(path, properties)
fopen(path, 'r:EUC-JP') {|f|
fopen(path, 'r:UTF-8') {|f|
BitClust::Preprocessor.wrap(f, properties).map {|line| line.strip }
}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bitclust/preprocessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.read(path, params = {})
if path.respond_to?(:gets)
io = wrap(path, params)
else
io = wrap(fopen(path, 'r:EUC-JP'), params)
io = wrap(fopen(path, 'r:UTF-8'), params)
end
ret = ""
while s = io.gets
Expand All @@ -53,7 +53,7 @@ def self.read(path, params = {})
end

def Preprocessor.process(path, params = {})
fopen(path, 'r:EUC-JP') {|f|
fopen(path, 'r:UTF-8') {|f|
return wrap(f, params).to_a
}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bitclust/refsdatabase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module BitClust
class RefsDatabase
def self.load(src)
if src.respond_to?(:to_str)
buf = fopen(src.to_str, 'r:EUC-JP'){|f| f.read}
buf = fopen(src.to_str, 'r:UTF-8'){|f| f.read}
elsif src.respond_to?(:to_io)
buf = src.to_io.read
else
Expand Down Expand Up @@ -41,7 +41,7 @@ def [](type, mid, linkid)
def save(s)
if s.respond_to?(:to_str)
path = s.to_str
io = fopen(path, 'w:EUC-JP')
io = fopen(path, 'w:UTF-8')
elsif s.respond_to?(:to_io)
io = s.to_io
else
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/rrdparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def initialize(db)
attr_reader :db

def parse_file(path, libname, params = {})
fopen(path, 'r:EUC-JP') {|f|
fopen(path, 'r:UTF-8') {|f|
return parse(f, libname, params)
}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'optparse'

unless Object.const_defined?(:Encoding)
$KCODE = 'EUC'
$KCODE = 'UTF-8'
end

def srcdir_root
Expand Down
2 changes: 1 addition & 1 deletion lib/bitclust/screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(h)

def default_message_catalog(h)
dir = h[:catalogdir] || "#{h[:datadir]}/catalog"
loc = MessageCatalog.encoding2locale(h[:encoding] || 'euc-jp')
loc = MessageCatalog.encoding2locale(h[:encoding] || 'utf-8')
MessageCatalog.load_with_locales(dir, [loc])
end
private :default_message_catalog
Expand Down
4 changes: 2 additions & 2 deletions lib/bitclust/subcommand.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def prepare
rubydoc_dir = config_dir + "rubydoc"
@config = {
:database_prefix => (config_dir + "db").to_s,
:encoding => "euc-jp",
:encoding => "utf-8",
:versions => @versions,
:default_version => @versions.max,
:stdlibtree => (rubydoc_dir + "refm/api/src").to_s,
Expand Down Expand Up @@ -550,7 +550,7 @@ def initialize
@baseurl = nil
@dbpath = nil
@srcdir = @datadir = @themedir = @theme = @templatedir = nil
@encoding = 'euc-jp' # encoding of view
@encoding = 'utf-8' # encoding of view
if Object.const_defined?(:Encoding)
Encoding.default_external = @encoding
end
Expand Down
4 changes: 2 additions & 2 deletions standalone.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/ruby -Ke
#!/usr/bin/ruby -Ku
#
# $Id$
#
Expand All @@ -20,7 +20,7 @@ def srcdir_root
baseurl = nil
dbpath = nil
srcdir = libdir = datadir = themedir = theme = templatedir = nil
encoding = 'euc-jp' # encoding of view
encoding = 'utf-8' # encoding of view
set_srcdir = lambda {|path|
srcdir = path
datadir ||= "#{srcdir}/data/bitclust"
Expand Down
2 changes: 1 addition & 1 deletion test/test_methoddatabase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setup
@db.transaction {
[
%w[version 1.9.1],
%w[encoding euc-jp]
%w[encoding utf-8]
].each do |k,v|
@db.propset(k, v)
end
Expand Down
6 changes: 3 additions & 3 deletions test/test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def test_run_init
mock(::BitClust::InitCommand).new.returns(command)
mock(@runner).load_config.returns(@config)
mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
command.parse(["version=1.9.3", "encoding=euc-jp"])
command.exec(@db, ["version=1.9.3", "encoding=euc-jp"]).returns(nil)
@runner.run(["init", "version=1.9.3", "encoding=euc-jp"])
command.parse(["version=1.9.3", "encoding=utf-8"])
command.exec(@db, ["version=1.9.3", "encoding=utf-8"]).returns(nil)
@runner.run(["init", "version=1.9.3", "encoding=utf-8"])
end

def test_run_list
Expand Down
10 changes: 5 additions & 5 deletions tools/bc-convert.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# -*- coding: euc-jp -*-
# -*- coding: utf-8 -*-

$KCODE = 'EUC' unless Object.const_defined?(:Encoding)
$KCODE = 'UTF-8' unless Object.const_defined?(:Encoding)

require 'stringio'
require 'fileutils'
Expand Down Expand Up @@ -150,9 +150,9 @@ def convert_href(link)
when /\Atrap::(.*)/ then "[[trap:#{$1}]]"
when /\Aruby 1\.\S+ feature/ then "((<#{link}>))"
when /\Aobsolete/ then "((<obsolete>))"
when /\A組み込み変数\/(.*)/e then "[[m:#{$1}]]"
when /\A組み込み定数\/(.*)/e then "[[m:Kernel::#{$1}]]"
when /\A組み込み関数\/(.*)/e then "[[m:Kernel\##{$1}]]"
when /\A組み込み変数\/(.*)/u then "[[m:#{$1}]]"
when /\A組み込み定数\/(.*)/u then "[[m:Kernel::#{$1}]]"
when /\A組み込み関数\/(.*)/u then "[[m:Kernel\##{$1}]]"
when /\A([\w:]+[\#\.][^|]+)\|/ then "[[m:#{$1}]]"
when /\A(.*?)\|manual page\z/ then "[[man:#{$1}]]"
when /\A([\w:]+)\/(.*)\z/n then "[[m:#{$1}\##{$2}]]"
Expand Down
14 changes: 7 additions & 7 deletions tools/bc-tochm.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# -*- coding: euc-jp -*-
# -*- coding: utf-8 -*-
require 'pathname'
def srcdir_root
(Pathname.new(__FILE__).realpath.dirname + '..').cleanpath
Expand Down Expand Up @@ -46,11 +46,11 @@ def finish
Error log file=refm.log
Full-text search=Yes
Index file=refm.hhk
Language=0x411 日本語 (日本)
Title=Rubyリファレンスマニュアル
Language=0x411 日本語 (日本)
Title=Rubyリファレンスマニュアル
[WINDOWS]
titlewindow="Rubyリファレンスマニュアル","refm.hhc","refm.hhk","doc/index.html","doc/index.html",,,,,0x21420,,0x387e,,,,,,,,0
titlewindow="Rubyリファレンスマニュアル","refm.hhc","refm.hhk","doc/index.html","doc/index.html",,,,,0x21420,,0x387e,,,,,,,,0
[FILES]
<%= @html_files.join("\n") %>
Expand Down Expand Up @@ -168,10 +168,10 @@ def document_url(name)

def main
@sitemap = {
:library => Sitemap.new('ライブラリ', 'library/index.html'),
:library => Sitemap.new('ライブラリ', 'library/index.html'),
}
@sitemap[:library] << Sitemap::Content.new('標準ライブラリ', 'library/_builtin.html')
@sitemap[:library] << Sitemap::Content.new('添付ライブラリ')
@sitemap[:library] << Sitemap::Content.new('標準ライブラリ', 'library/_builtin.html')
@sitemap[:library] << Sitemap::Content.new('添付ライブラリ')
@stdlibs = {}
@index_contents = []
prefix = Pathname.new('./db')
Expand Down
4 changes: 2 additions & 2 deletions tools/bc-tohtml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def srcdir_root

$LOAD_PATH.unshift srcdir_root() + 'lib'

$KCODE = 'EUC' unless Object.const_defined?(:Encoding)
$KCODE = 'UTF-8' unless Object.const_defined?(:Encoding)

require 'bitclust'
require 'optparse'
Expand Down Expand Up @@ -70,7 +70,7 @@ def main
:templatedir => templatedir,
:base_url => baseurl,
:cgi_url => baseurl,
:default_encoding => 'euc-jp')
:default_encoding => 'utf-8')
unless @rd_file
begin
if @capi
Expand Down
4 changes: 2 additions & 2 deletions tools/bc-tohtmlpackage.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# -*- coding: euc-jp -*-
# -*- coding: utf-8 -*-
require 'pathname'

def srcdir_root
Expand All @@ -12,7 +12,7 @@ def srcdir_root
require 'optparse'

if Object.const_defined?(:Encoding)
Encoding.default_external = 'euc-jp'
Encoding.default_external = 'utf-8'
end

module BitClust
Expand Down
Loading

0 comments on commit 701fe9b

Please sign in to comment.