Closes #1162: Problems with codeviewer

 - added String#encode in codeviewer.rjs
fix the mistake with page.replace_html
Merge pull request #1167 from GhiGt/codeviewer-escaped

Closes #1162: Problems with codeviewer