Typing spaces in Ace Editor results in special characters

主宰稳场 提交于 2019-12-10 13:23:44

问题


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?


回答1:


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>



回答2:


It seems like the

charset="utf-8"

is the important part.



来源:https://stackoverflow.com/questions/17108641/typing-spaces-in-ace-editor-results-in-special-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!