CKEDITOR,是回归一些奇怪的人物

时间:2010-06-06 01:09:03

标签: ckeditor

使用CKEDITOR,当我使用JS获取文本编辑器的内容时​​,我回来了:

<p>\u000a\u0009&nbsp;ad adad ad asd</p>\u000a

当我应该得到的时候:

<p>ad adad ad asd</p>

知道这里发生了什么吗?

唯一可能的原因是我在加载时动态创建了textareas,并使用类来查找编辑器:

$('.guideItem-textarea').each(function(index, value){
    // ID of the textarea
    var targeteditor = $(this).attr('id');
    var targeteditorID = $(this).attr('id').replace('noteguide','');

    // Contents in the editor
    textareacontents = CKEDITOR.instances[targeteditor].getData();
});

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

那些奇怪的字符是unicode控制字符。第一个是换行,seond是一个标签。你的例子中的数据真的是问题中的值吗?也许您从其他来源预先填充了文本?

在你想出这个之后建议阅读: http://www.joelonsoftware.com/articles/Unicode.html

相关问题