diff --git a/index.html b/index.html
index f6823b176f427071688db41b7d70353c5e167acf..6a1b8c3712a6f60caaab0fe58af729c5d5f77c4c 100644
--- a/index.html
+++ b/index.html
@@ -39,14 +39,14 @@
 
 		$( document ).ready(function() {
 			window.addEventListener('hashchange', function() {
-				elText.value = location.hash.substring(1)
+				elText.value = decodeURIComponent(location.hash.substring(1));
 				generateQR();
 			});
 			elText = document.getElementById("text");
 			elText.oninput = function () {
-				window.location.hash = elText.value;
+				window.location.hash = encodeURIComponent(elText.value);
 			};
-			elText.value = location.hash.substring(1);
+			elText.value = decodeURIComponent(location.hash.substring(1));
 
 			generateQR();
 		});