diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js
index c21a136..6e3aeff 100644
--- a/IPython/html/static/notebook/js/codecell.js
+++ b/IPython/html/static/notebook/js/codecell.js
@@ -409,7 +409,12 @@ var IPython = (function (IPython) {
CodeCell.input_prompt_classical = function (prompt_value, lines_number) {
- var ns = prompt_value || " ";
+ var ns;
+ if (prompt_value == undefined) {
+ ns = " ";
+ } else {
+ ns = encodeURIComponent(prompt_value);
+ }
return 'In [' + ns + ']:';
};