Cam*_*Cam 9 linux html-entities linux-toolchain
有没有办法可以使用标准的linux工具链做以下的事情?
让我们说example.com/index.php上的源代码是:
Hello, & world! "
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做......
curl -s http://example.com/index.php | htmlentities
Run Code Online (Sandbox Code Playgroud)
......将打印以下内容:
Hello, & world! "
Run Code Online (Sandbox Code Playgroud)
只使用标准的linux工具链?
Dav*_*d Z 18
使用recode.
$ echo 'Hello, & world! "' | recode HTML_4.0
Hello, & world! "
Run Code Online (Sandbox Code Playgroud)
编辑:顺便提一下,recode提供了与HTML和XML的不同版本相对应的几种不同的转换,因此您可以使用eg HTML_3.2而不是HTML_4.0如果您有一个非常旧的HTML文档.运行recode -l将列出程序支持的所有完整的字符集列表.
alias decode="php -r 'echo html_entity_decode(fgets( STDIN ));'"
$ echo 'Hello, & world! "' | decode
Hello, & world! "
Run Code Online (Sandbox Code Playgroud)