ANSI转为HTML5库
<?php namespace SensioLabs\AnsiConverter\Tests; use SensioLabs\AnsiConverter\AnsiToHtmlConverter; class AnsiToHtmlConverterTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider getConvertData */ public function testConvert($expected, $input) { $converter = new AnsiToHtmlConverter(); $this->assertEquals($expected, $converter->convert($input)); } public function getConvertData() { return array( // text is escaped array('<span style="background-color: black; color: white">foo <br /></span>', 'foo <br />'), // newlines are preserved array("<span style=\"background-color: black; color: white\">foo\nbar</span>", "foo\nbar"), // backspaces array('<span style="background-color: black; color: white">foo </span>', "foobar\x08\x08\x08 "), array('<span style="background-color: black; color: white">foo</span><span style="background-color: black; color: white"> </span>', "foob\e[31;41ma\e[0mr\x08\x08\x08 "), // color array('<span style="background-color: darkred; color: darkred">foo</span>', "\e[31;41mfoo\e[0m"), // color with [m as a termination (equivalent to [0m]) array('<span style="background-color: darkred; color: darkred">foo</span>', "\e[31;41mfoo\e[m"), // bright color array('<span style="background-color: red; color: red">foo</span>', "\e[31;41;1mfoo\e[0m"), // carriage returns array('<span style="background-color: black; color: white">foobar</span>', "foo\rbar\rfoobar"), // underline array('<span style="background-color: black; color: white; text-decoration: underline">foo</span>', "\e[4mfoo\e[0m"), // non valid unicode codepoints substitution (only available with PHP >= 5.4) PHP_VERSION_ID < 50400 ?: array('<span style="background-color: black; color: white">foo '."\xEF\xBF\xBD".'</span>', "foo \xF4\xFF\xFF\xFF"), ); } }
ANSI是一种字符代码,为使计算机支持更多语言,通常使用 0x00~0x7f 范围的1 个字节来表示 1 个英文字符。超出此范围的使用0x80~0xFFFF来编码,即扩展的ASCII编码。
HTML则是超文本标记语言,标准通用标记语言下的一个应用。“超文本”就是指页面内可以包含图片、链接,甚至音乐、程序等非文字元素。超文本标记语言的结构包括“头”部分(英语:Head)、和“主体”部分(英
免责声明
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章

26Oct2024
将 HTML5 FormData 转换为 JSON 将 HTML5 FormData 对象的条目转换为 JSON 是 Web 开发中的一项常见任务。虽然有...

31Dec2024
在 GoIn Go 中将 ANSI 文本转换为 UTF-8,所有字符串均采用 UTF-8 编码。要将 ANSI 字符串转换为 UTF-8 字符串,您需要执行...

03Nov2024
将 MySQL Dump SQL 转换为 Sqlite3 DBI将 MySQL Dump SQL 文件导入 SQLite3 数据库需要转换以确保兼容性。...

13Nov2024
将 BufferedInputStream 转换为 Image 问题:如何将从数据库检索的 BufferedInputStream 对象转换为 BufferedImage?...


Hot Tools

热门文章
Hello Kitty 岛冒险:巧克力猫角色指南
24Jan2025手游攻略
如何修复KB5050081无法在Windows 10中安装?
31Jan2025故障排查
如何修复 Windows 更新错误 0x80070306?
22Jan2025故障排查
AI Checkers可能会标记您的写作的4个原因,即使您不使用Chatgpt
27Jan2025人工智能
丢失记录:Bloom&Rage -Corey和Dylan的锁组合
19Feb2025手游攻略