current location: Home > download site > Library download > Other libraries > php library to convert ANSI to HTML5
php library to convert ANSI to HTML5
Classify: Library download / Other libraries | Release time: 2017-12-13 | visits: 945 |
Download: 44 |
Latest Downloads
Fantasy Aquarium
Girls Frontline
Wings of Stars
Little Flower Fairy Fairy Paradise
Restaurant Cute Story
Shanhe Travel Exploration
Love and Producer
The most powerful brain 3
Odd Dust: Damila
Young Journey to the West 2
24 HoursReading Leaderboard
- 1 How to Extend and Override Django Admin Templates Without Replacing Them?
- 2 How to Combine Two Arrays in JavaScript?
- 3 dynexwcui.exe - What is dynexwcui.exe?
- 4 How to Override Styles in a Shadow-Root Element?
- 5 How to Create a Dynamic Pivot Table in MySQL with Integer User IDs?
- 6 dtvimpex.dll - What is dtvimpex.dll?
- 7 Why does "go module @latest found but does not contain package" Error Occur When Using github.com/mkideal/cli?
- 8 Why Do Lambda Expressions Sometimes Fail to Pass the Correct Parameters When Connecting Slots in PyQt?
- 9 How to Dynamically Create CSS @-keyframes Animations Based on Server Responses?
- 10 How to Select a Label with a Specific 'for' Attribute in CSS?
- 11 Why Can't I Assign to a Struct Field in a Map?
- 12 How to Retrieve the Value of a Submitted Button in a Form with Multiple Buttons?
- 13 When Should You Use Getters/Setters Instead of Public Data Members?
- 14 Who is Running My PHP Script?
- 15 Why Am I Getting "SMTP Error: Could Not Authenticate" When Sending Emails with PHPMailer?
Latest Tutorials
-
- Go language practical GraphQL
- 2009 2024-04-19
-
- 550W fan master learns JavaScript from scratch step by step
- 3428 2024-04-18
-
- Getting Started with MySQL (Teacher mosh)
- 1810 2024-04-07
-
- Mock.js | Axios.js | Json | Ajax--Ten days of quality class
- 2623 2024-03-29
<?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 is a character code. In order to enable the computer to support more languages, 1 byte in the range of 0x00~0x7f is usually used to represent 1 English character. Anything outside this range is encoded using 0x80~0xFFFF, which is extended ASCII encoding.
In order for the computer to support more languages, 2 bytes in the range of 0x80~0xFFFF are usually used to represent 1 character. For example: the Chinese character '中' is stored in
ANSI encoding
ANSI encoding
Chinese operating system, using the two bytes [0xD6,0xD0] for storage.
Different countries and regions have formulated different standards, resulting in their own encoding standards such as GB2312, GBK, GB18030, Big5, and Shift_JIS. These various Chinese character extended encoding methods that use multiple bytes to represent a character are called ANSI encoding. In the Simplified Chinese Windows operating system, ANSI encoding represents GBK encoding; in the Traditional Chinese Windows operating system, ANSI encoding represents Big5; in the Japanese Windows operating system, ANSI encoding represents Shift_JIS encoding.
Different ANSI codes are incompatible with each other. When information is exchanged internationally, text belonging to two languages cannot be stored in the same ANSI coded text.
ANSI encoding uses one byte to represent English characters, and two or four bytes to represent Chinese characters.