我使用HTTPoison
來獲取elixir指南網站,然後使用Floki
解析它以構建一個HTML 2 Jupyter Notebook變壓器(使用Markdown作爲描述)。我必須投入「反撥」。用於代碼突出顯示的\u0060
,迄今爲止工作。我有一些地方使用字符串插值和其他位置Enum.join ""
來處理和轉換HTML到Markdown。使用unicode編碼json使用毒物
根據jupyter notebookformat將轉換後的結果存儲在地圖中。當我撥打Poison.encode notebook
時,我收到一個錯誤消息,因爲代碼點消失了。我嘗試過不同的事情,但還不知道問題出在哪裏。
任何提示我在處理文本時做錯了什麼?這是個例外:
** (Poison.EncodeError) unable to encode value: {:source, ["Elixir also provides `Port`, `Reference` and `PID` as data types (usually used in process communication), and we will take a quick look at them when talking about processes. For now, let’s take a look at some of the basic operators that go with our basic types."]}
lib/poison/encoder.ex:377: Poison.Encoder.Any.encode/2
lib/poison/encoder.ex:255: anonymous fn/3 in Poison.Encoder.List.encode/3
lib/poison/encoder.ex:256: Poison.Encoder.List."-encode/3-lists^foldr/2-1-"/3
lib/poison/encoder.ex:256: Poison.Encoder.List.encode/3
lib/poison.ex:41: Poison.encode!/2
(guide2nb) lib/cli.ex:27: CLI.process/1
(elixir) lib/kernel/cli.ex:76: anonymous fn/3 in Kernel.CLI.exec_fun/2
您試圖編碼的值看起來不像地圖,而是一個元組。在此處粘貼您的原始值(和/或試圖對其進行編碼的代碼) – Sheharyar
Poison不編碼元組。 –