Index: /platform/tdiary/util/tdiary-for-ruby1.9/compatible.rb
===================================================================
--- /platform/tdiary/util/tdiary-for-ruby1.9/compatible.rb (revision 6190)
+++ /platform/tdiary/util/tdiary-for-ruby1.9/compatible.rb (revision 6190)
@@ -0,0 +1,91 @@
+# = for Ruby1.9.0 compatible =
+#
+# == ����==
+#
+#  * Ruby1.9 �ξ���--encoding=Binary ���ץ����������뤳��
+# --------------------------------------------------------
+# ��Ū���� --------------------------------------------------------
+
+# for Ruby1.9.0
+
+unless "".respond_to?('to_a')
+  class String
+    def to_a
+      [ self ]
+    end
+  end
+end
+
+unless "".respond_to?('each')
+  class String
+    alias each each_line
+  end
+end
+
+# Ruby1.9�Ǥ�String �� Enumerable �ǤϤʤ��ʤä�
+class String
+  def method_missing(name, *args, &block)
+    each_line.__send__(name, *args, &block)
+  end
+end
+
+
+# for Ruby1.8.X
+
+unless "".respond_to?('force_encoding')
+  class String
+    def force_encoding(encoding)
+      self
+    end
+  end
+end
+
+unless "".respond_to?('bytesize')
+  class String
+    alias bytesize size
+  end
+end
+
+unless "".respond_to?('ord')
+  class String
+    def ord
+      self[0]
+    end
+  end
+
+  class Integer
+    def ord
+      self
+    end
+  end
+end
+
+# --------------------------------------------------------
+# tDiary ����� --------------------------------------------------------
+
+# Ruby1.9��KF::nkf��֤����encoding������Ƥ��ޤ���
+# ���Τ��ᡢencoding��Binary�δĶ����������# "character encodings differ" ���顼�Ȥʤ롣
+begin
+  require 'nkf'
+  module NKF
+    alias :_nkf :nkf
+    def nkf(option, src)
+      r = _nkf(option, src)
+      r.force_encoding('Binary')
+    end
+    module_function :nkf, :_nkf
+  end
+rescue
+end
+
+# �����ޤ��å��ߤ����diary.last_modified �� String �ˤʤ�����)
+# (PStore �¸���Time ���, �¸�� String �Ȥʤ�# �����String ��ä���ime ��Ѵ�����odule TDiary
+  class WikiDiary
+    def last_modified
+      if @last_modified.class == String
+        @last_modified = Time.at(0)
+      end
+      @last_modified
+    end
+  end
+end
Index: /platform/tdiary/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch
===================================================================
--- /platform/tdiary/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch (revision 6190)
+++ /platform/tdiary/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch (revision 6190)
@@ -0,0 +1,98 @@
+Index: update.rb
+===================================================================
+--- update.rb	(revision 97)
++++ update.rb	(working copy)
+@@ -5,7 +5,7 @@
+ # Copyright (C) 2001-2003, TADA Tadashi <sho@spc.gr.jp>
+ # You can redistribute it and/or modify it under GPL2.
+ #
+-BEGIN { $defout.binmode }
++BEGIN { $stdout.binmode }
+ $KCODE = 'n'
+ 
+ begin
+Index: misc/lib/hikidoc.rb
+===================================================================
+--- misc/lib/hikidoc.rb	(revision 97)
++++ misc/lib/hikidoc.rb	(working copy)
+@@ -476,7 +476,7 @@
+ 
+   def escape_meta_char( text )
+     text.gsub( META_CHAR_RE ) do |s|
+-      '&#x%x;' % s[1]
++      '&#x%x;' % s[1].ord
+     end
+   end
+ 
+Index: misc/plugin/amazon.rb
+===================================================================
+--- misc/plugin/amazon.rb	(revision 97)
++++ misc/plugin/amazon.rb	(working copy)
+@@ -205,6 +205,7 @@
+ 				xml =  amazon_call_ecs( asin, id_type )
+ 				File::open( "#{cache}/#{asin}.xml", 'wb' ) {|f| f.write( xml )}
+ 			end
++			xml.force_encoding('UTF-8')
+ 			doc = REXML::Document::new( xml ).root
+ 			item = doc.elements.to_a( '*/Item' )[0]
+ 			if pos == 'detail' then
+Index: tdiary.rb
+===================================================================
+--- tdiary.rb	(revision 97)
++++ tdiary.rb	(working copy)
+@@ -11,6 +11,7 @@
+ 
+ $:.insert( 1, File::dirname( __FILE__ ) + '/misc/lib' )
+ 
++require 'compatible'
+ require 'cgi'
+ require 'uri'
+ begin
+@@ -466,6 +467,7 @@
+ 			load
+ 
+ 			instance_variables.each do |v|
++				v = v.to_s
+ 				v.sub!( /@/, '' )
+ 				instance_eval( <<-SRC
+ 					def #{v}
+@@ -631,11 +633,10 @@
+ 				cgi_conf.untaint unless @secure
+ 				def_vars = ""
+ 				variables.each do |var| def_vars << "#{var} = nil\n" end
+-				eval( def_vars )
++				extend_vars = 'variables.each do |var| eval "@#{var} = #{var} if #{var} != nil" end'
+ 				Safe::safe( @secure ? 4 : 1 ) do
+-					eval( cgi_conf, binding, "(TDiary::Config#cgi_conf)", 1 )
++					eval( def_vars + cgi_conf + extend_vars, binding, "(TDiary::Config#cgi_conf)", 1 )
+ 				end
+-				variables.each do |var| eval "@#{var} = #{var} if #{var} != nil" end
+ 			rescue IOError, Errno::ENOENT
+ 			end
+ 		end
+Index: plugin/ja/05referer.rb
+===================================================================
+--- plugin/ja/05referer.rb	(revision 97)
++++ plugin/ja/05referer.rb	(working copy)
+@@ -31,7 +31,7 @@
+ 	<p>��<a href="#{h @update}?referer=volatile" target="referer">����Ϥ����a></p>
+ 	<p><textarea name="only_volatile" cols="70" rows="10">#{h @conf.only_volatile2.join( "\n" )}</textarea></p>
+ 	<h3 class="subtitle">#{label_referer_table}</h3>
+-	#{"<p>�������ꥹ�Ȥ�RL����ʸ�����������ɽ������ޤ���1���Ĥ���URL�����ʸ����Ƕ��äƻ�ꤷ�ޤ������ɽ�����Ȥ����ǡ�URL��˸��줿�����פϡ����ʸ���ǡ�\1�פΤ褦�ʡ���פ�����ޤ���</p>" unless @conf.mobile_agent?}
++	#{"<p>�������ꥹ�Ȥ�RL����ʸ�����������ɽ������ޤ���1���Ĥ���URL�����ʸ����Ƕ��äƻ�ꤷ�ޤ������ɽ�����Ȥ����ǡ�URL��˸��줿�����פϡ����ʸ���ǡ�\\\1�פΤ褦�ʡ�\��פ�����ޤ���</p>" unless @conf.mobile_agent?}
+ 	<p>��<a href="#{h @update}?referer=table" target="referer">����Ϥ����a></p>
+ 	<p><textarea name="referer_table" cols="70" rows="10">#{h @conf.referer_table2.collect{|a|a.join( " " )}.join( "\n" )}</textarea></p>
+ 	HTML
+Index: index.rb
+===================================================================
+--- index.rb	(revision 97)
++++ index.rb	(working copy)
+@@ -5,7 +5,7 @@
+ # Copyright (C) 2001-2006, TADA Tadashi <sho@spc.gr.jp>
+ # You can redistribute it and/or modify it under GPL2.
+ #
+-BEGIN { $defout.binmode }
++BEGIN { $stdout.binmode }
+ $KCODE = 'n'
+ 
+ begin
