fixes for unicode
diff --git a/public/js/all-app.js b/public/js/all-app.js
index 817bef8..6be9a41 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -1844,7 +1844,7 @@
 this.copy_doc(fn,1);}
 _f.get_value=function(dt,dn,fn){if(locals[dt]&&locals[dt][dn])
 return locals[dt][dn][fn];}
-_f.Frm.prototype.set_value_in_locals=function(dt,dn,fn,v){var d=locals[dt][dn];var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))
+_f.Frm.prototype.set_value_in_locals=function(dt,dn,fn,v){var d=locals[dt][dn];if(!d)return;var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))
 changed=false;if(changed){d[fn]=v;if(d.parenttype)
 d.__unsaved=1;this.set_unsaved();}}
 _f.Frm.prototype.set_unsaved=function(){if(cur_frm.doc.__unsaved)return;cur_frm.doc.__unsaved=1;cur_frm.frm_head.refresh_labels()}
diff --git a/public/server.py b/public/server.py
index 2b5e238..497346c 100755
--- a/public/server.py
+++ b/public/server.py
@@ -39,12 +39,14 @@
 import webnotes.handler
 import webnotes.auth
 
+from webnotes.utils import cstr
+
 def init():
 	# make the form_dict
 	webnotes.form = cgi.FieldStorage(keep_blank_values=True)
 	for key in webnotes.form.keys():
-		webnotes.form_dict[key] = webnotes.form.getvalue(key)
-
+		webnotes.form_dict[key] = cstr(webnotes.form.getvalue(key))
+	
 	# init request
 	try:
 		webnotes.http_request = webnotes.auth.HTTPRequest()
diff --git a/public/web.py b/public/web.py
index ed0441f..4696ebe 100755
--- a/public/web.py
+++ b/public/web.py
@@ -41,6 +41,7 @@
 
 def respond():
 	import webnotes
+	from webnotes.utils import get_encoded_string
 	try:
 		if 'page' in webnotes.form_dict:
 			html = get_html(webnotes.form_dict['page'])
@@ -52,7 +53,7 @@
 
 	print "Content-Type: text/html"
 	print
-	print html.encode('utf-8')
+	print get_encoded_string(html)
 
 def get_html(page_name):
 	import website.utils