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