2016-08-10 3 views
4

ここにデコードしようとしている文字列があります。エリクシールで文字列をhtmlでデコードする方法は?

"Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD" 

私はのような文字列で終わるしたい:私はURI.decode機能を使用して試してみたが、それは動作しません

"Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD" 

、私は同じ&シンボルを取得します。

iex(1)> URI.decode "Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD" 
"Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD" 
+0

https://github.com/martinsvalin/html_entities – Dogbert

答えて

6

Hex.pm

defp deps do 
    [{:html_entities, "~> 0.3"}] 
end 

からhtml_entitiesパッケージを追加しますそれからちょうどそれあなたの文字列を渡す:

iex> HtmlEntities.decode("Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD") 
"Ren & Stimpy The Lost Episodes Disc.1 [MP4-AAC] 480p DVD" 
関連する問題