4
当我尝试粘贴HTML文本文件时,我总是被踢出壳体。如何才能做到这一点?我是否首先需要使用一些JavaScript来编码它或什么?如何将HTML插入到Mongodb中?
例子:
db.test.insert({x:"<div id='product-description'><p>Who hasn’t wished for a mini-Roomba to handle the arduous task of cleaning their iPhone screen? Now your dreams have come true!</p> <p>See the Takara web page for a <a href='http://www.takaratomy.co.jp/products/automee/' title='automee s' target='_blank'>demo video.</a></p>
<p><strong>Colors: </strong> White, Red, Orange and Blue<br>
Runs on a single AA battery.</p>
<p>1,575 yen</p><!-- end #product-description --></div>"})
编辑
我只放单引号我的HTML内部和双引号包裹了整个事情,但还是没有好。 shell错误:
> j = ({z:"<div id='product-description'><p>Who hasn
---
Unicode text could not be correctly displayed.
Please change your console font to a Unicode font (e.g. Lucida Console).
---
’
bye
由于这个问题的格式明确显示,您需要转义HTML实体... – Sammaye 2013-03-07 15:53:52
我只有一双双引号!我认为这可能会解决它,但不。我需要逃避什么以及如何?有一些标准功能吗? – 2013-03-07 15:57:51
如果您不想关心引用问题,请使用base64编码/解码。 – 2013-03-07 16:04:29