Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typing spaces in Ace Editor results in special characters

I've installed ace editor into my site, and although when I tested it in a dev environment , now with the same code I am experiencing typing errors - specifically when hitting space or delete.

When I click space strange characters appear instead. Here is an example of my code and an image of what I am seeing.

$(function(){

var editor = ace.edit("editor");
editor.setTheme("ace/theme/chrome");
editor.getSession().setMode("ace/mode/html");

});

Can anybody help?

enter image description here

like image 797
Mazatec Avatar asked Jun 14 '13 12:06

Mazatec


2 Answers

It turned out that this issue was because I included the script like:

<script src="src-min/ace.js"></script>

and I should have included the following attributes:

<script src="src-min/ace.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
like image 160
Mazatec Avatar answered Sep 20 '22 13:09

Mazatec


It seems like the

charset="utf-8"

is the important part.

like image 34
csander Avatar answered Sep 18 '22 13:09

csander