OSDN Git Service

fix bug.
[rec10/rec10-git.git] / Rec10WEB / trunk / src / rec10web.py
index cd18438..8e2f93f 100644 (file)
@@ -87,7 +87,7 @@ def getRecDate():
         s = str(id) + "," + typet + "," + chtxt + "," + title + "," + btime + "," + etime + "," + deltaday + "," + opt + "\n"
         recdata = recdata + s
     f = open(path + "/recdatum.csv", "w")
-    f.write(recdata)
+    f.write(recdata.encode('utf-8'))
     f.close()
 def getiEPGDate():
     dl = database.select_all_iepg()
@@ -98,7 +98,7 @@ def getiEPGDate():
         s = s + d[0] + "," + d[1] + "," + d[2] + "\n"
     recdata = recdata + s
     f = open(path + "/iepgdatum.csv", "w")
-    f.write(recdata)
+    f.write(recdata.encode('utf-8'))
     f.close()
 def getchtxt():
     dl = database.select_all_epg_ch()
@@ -234,27 +234,27 @@ def readHtmlSrcSimple():
     f = open(path + 'rswi.htm')
     ret = f.read()
     f.close()
-    return ret
+    return unicode(ret,'utf-8')
 def readRecFinisSimple():
     f = open(path + 'fin.htm')
     ret = f.read()
     f.close()
-    return ret
+    return unicode(ret,'utf-8')
 def readRecSchedule():
     f = open(path + 'schedule.htm')
     ret = f.read()
     f.close()
-    return ret
+    return unicode(ret,'utf-8')
 def readiEPGadd():
     f = open(path + 'iepg_add.htm')
     ret = f.read()
     f.close()
-    return ret
+    return unicode(ret,'utf-8')
 def readiEPGshow():
     f = open(path + 'iepg_show.htm')
     ret = f.read()
     f.close()
-    return ret
+    return unicode(ret,'utf-8')
 def get_fin(string, refreshurl):
     htmdate = readRecFinisSimple()
     htmdate = htmdate.replace('<!--text_for_replace_fin//-->', string)
@@ -295,7 +295,7 @@ def mode_recover():
 def mode_normal():
     htmdate = readHtmlSrcSimple()
     htmdate = htmdate.replace("<!--exec-value//-->", "yes")
-    return unicode(htmdate,'utf-8')
+    return htmdate
 def mode_del():
     s = u"予約を削除しました。"
     u = "rec10web.py?exec=schedule"
@@ -357,16 +357,16 @@ if f.getfirst('station'):
         exect = "iepg-add"
 ###ここから外部からの読み出しの場合
 if f.getfirst('type'):
-    type = f.getfirst('type')
+    type = unicode(f.getfirst('type'),'utf-8')
 if f.getfirst('title'):
-    title = f.getfirst('title')
+    title = unicode(f.getfirst('title'),'utf-8')
 if f.getfirst('chtxt'):
-    chtxt = f.getfirst('chtxt')
+    chtxt = unicode(f.getfirst('chtxt'),'utf-8')
 if f.getfirst('btime'):
-    btime = f.getfirst('btime')
+    btime = unicode(f.getfirst('btime'),'utf-8')
     bt = datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3])
 if f.getfirst('etime'):
-    etime = f.getfirst('etime')
+    etime = unicode(f.getfirst('etime'),'utf-8')
     et = datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3])
     if bt != "":
         delt = et-bt
@@ -374,13 +374,13 @@ if f.getfirst('etime'):
         if dt < 0:
             dd = datetime.timedelta(days=1)
             et = et + dd
-            etime = et.strftime("%Y-%m-%d %H:%M:%S")
+            etime = unicode(et.strftime("%Y-%m-%d %H:%M:%S"),'utf-8')
         if dt < -1 * 24 * 60 * 60:
             d1 = datetime.datetime(bt.year, 0, 0)
             d2 = datetime.datetime(bt.year + 1, 0, 0)
             dd = d2-d1
             et = et + dd
-            etime = et.strftime("%Y-%m-%d %H:%M:%S")
+            etime = unicode(et.strftime("%Y-%m-%d %H:%M:%S"),'utf-8')
 size = "S"
 if f.getfirst('size'):
     size = f.getfirst('size')