diff --git a/index.html b/index.html
index 1d862f8..20ab276 100644
--- a/index.html
+++ b/index.html
@@ -157,6 +157,7 @@
+
diff --git a/js/b64Utils.js b/js/b64Utils.js
new file mode 100644
index 0000000..ff10bb5
--- /dev/null
+++ b/js/b64Utils.js
@@ -0,0 +1,31 @@
+/**
+ * Created with Notepad++.
+ * User: �iga Hajdukovi� (zigah)
+ * Date: 2013-11-03
+ * Time: 15:55
+ *
+ * These two functions are intended to replace btoa and atob
+ * that have a problem with handling Unicode caharacters in
+ * a player's g+ name.
+ *
+ * The functions below were effectively copy pasted from ecmanaut.blogspot.com
+ * as suggested by MDN: https://developer.mozilla.org/en-US/docs/Web/API/window.btoa
+ * and written by Johan Sundstr�m.
+ *
+ * In most browsers, calling window.btoa on a Unicode string
+ * will cause a Character Out Of Range exception.
+ * To avoid this, consider this pattern, noted by Johan Sundstr�m:
+ * http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html
+ *
+ */
+"use strict";
+
+var b64Utils = b64Utils || {};
+
+b64Utils.utf8_to_b64 = function(str) {
+ return window.btoa(unescape(encodeURIComponent( str )));
+};
+
+b64Utils.b64_to_utf8 = function(str) {
+ return decodeURIComponent(escape(window.atob( str )));
+};
diff --git a/js/challenge.js b/js/challenge.js
index 5b46055..418d4bc 100644
--- a/js/challenge.js
+++ b/js/challenge.js
@@ -33,7 +33,7 @@ challenge.tryToLoad = function()
var challengeString = challenge.getURLParameter('gamedata');
if (challengeString && challengeString != 'null') {
console.log("Received challenge string ", challengeString);
- var decodedString = atob(challengeString);
+ var decodedString = b64Utils.b64_to_utf8(challengeString);
console.log("Decoded as ", decodedString);
var challengeObject = JSON.parse(decodedString);
console.log("Parsed into ",challengeObject);
diff --git a/js/game.js b/js/game.js
index a56289f..2770ad1 100644
--- a/js/game.js
+++ b/js/game.js
@@ -142,7 +142,7 @@ game.populateBragButton = function() {
// Let's JSONify it
var challengeString = JSON.stringify(challengeObject);
- challengeString = btoa(challengeString);
+ challengeString = b64Utils.utf8_to_b64(challengeString);
var linkUrl = constants.LINK_PAGE_BASE + "?gamedata=" + challengeString;
// If we wanted, we could also have a different link for the calltoaction