<?php /* * This file is part of ansi-to-html. * * (c) 2013 Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SensioLabs\AnsiConverter; use SensioLabs\AnsiConverter\Theme\Theme; /** * Converts an ANSI text to HTML5. */ class AnsiToHtmlConverter { protected $theme; protected $charset; protected $inlineStyles; protected $inlineColors; protected $colorNames; public function __construct(Theme $theme = null, $inlineStyles = true, $charset = 'UTF-8') { $this->theme = null === $theme ? new Theme() : $theme; $this->inlineStyles = $inlineStyles; $this->charset = $charset; $this->inlineColors = $this->theme->asArray(); $this->colorNames = array( 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', '', '', 'brblack', 'brred', 'brgreen', 'bryellow', 'brblue', 'brmagenta', 'brcyan', 'brwhite', );
ANSI是一種字元代碼,為使電腦支援更多語言,通常使用 0x00~0x7f 範圍的1 個位元組來表示 1 個英文字元。超出此範圍的使用0x80~0xFFFF來編碼,即擴展的ASCII編碼。
為使電腦支援更多語言,通常使用 0x80~0xFFFF 範圍的 2 個位元組來表示 1 個字元。例如:漢字 '中' 在
ANSI編碼
ANSI編碼
#中文作業系統中,使用 [0xD6,0xD0] 這兩個位元組儲存。
不同的國家和地區制定了不同的標準,由此產生了 GB2312、GBK、GB18030、Big5、Shift_JIS 等各自的編碼標準。這些使用多個位元組來代表一個字元的各種漢字延伸編碼方式,稱為 ANSI 編碼。在簡體中文Windows作業系統中,ANSI 編碼代表 GBK 編碼;在繁體中文Windows作業系統中,ANSI編碼代表Big5;在日文Windows作業系統中,ANSI 編碼代表 Shift_JIS 編碼。
不同 ANSI 編碼之間互不相容,當訊息在國際間交流時,無法將屬於兩種語言的文字,儲存在同一段 ANSI 編碼的文本中。
ANSI編碼表示英文字元時用一個字節,表示中文用兩個或四個位元組。
本站所有資源皆由網友貢獻或各大下載網站轉載。請自行檢查軟體的完整性!本站所有資源僅供學習參考。請不要將它們用於商業目的。否則,一切後果都由您負責!如有侵權,請聯絡我們刪除。聯絡方式:admin@php.cn
相關文章
![如何使用 Python 的 XML 函式庫將 XML 檔案轉換為 Pandas DataFrame?](https://img.php.cn/upload/article/001/246/273/173253619397604.jpg)
25 Nov 2024
如何將 XML 檔案轉換為 Pandas Dataframe 將 XML 檔案轉換為結構化 pandas DataFrame 對於資料來說是一項有價值的任務...
![如何使用 org.json 函式庫將 JSON 字串轉換為 Java 中的 HashMap?](https://img.php.cn/upload/article/001/246/273/173147778382724.jpg)
13 Nov 2024
使用 org.json 函式庫在 Java 中將 JSON 字串轉換為 HashMap 在 Java 中處理 JSON 資料時,一個常見的任務是將 JSON 轉換為...
![哪些 JavaScript 函式庫可以將 JSON 資料轉換為 HTML 表?](https://img.php.cn/upload/article/001/246/273/173311453669802.jpg)
02 Dec 2024
使用庫將 JSON 資料轉換為 HTML 表格從 JSON 資料建立動態 HTML 表格是 Web 開發中的常見任務。雖然它是...
![如何使用Python的Pandas函式庫有效率地將JSON轉換為CSV?](https://img.php.cn/upload/article/001/246/273/173383075220675.jpg)
10 Dec 2024
在 Python 中將 JSON 資料轉換為 CSV 在 Python 中將 JSON 資料轉換為 CSV 可以使用多種方法來實作。然而,Pandas 庫提供...
![如何使用 org.json 和 Jackson 函式庫將 JSON 字串轉換為 Java 中的 HashMap?](https://img.php.cn/upload/article/001/246/273/173136486285660.jpg)
12 Nov 2024
在 Java 中將 JSON 字串轉換為 HashMap 當處理 JSON 格式的資料時,將其轉換為 HashMap 可能是儲存和...的有用方法。
![Java 的標準數學函式庫是否提供將數字轉換為其文字表示形式的函數?](https://img.php.cn/upload/article/001/246/273/173552846051653.jpg)
30 Dec 2024
如何在javaBackground中將數字轉換為單字當前,已經有一個基本的機制可以使用靜態數組將數字轉換為單字...
![](/static/imghw/down_right.png)
![](/static/imghw/taglogo.png)
Hot Tools
![](/static/imghw/taglogo.png)