search
HomeCommon ProblemHow many characters does one space occupy?

How many characters does one space occupy?

Jun 17, 2020 am 10:32 AM
characterspace

How many characters does one space occupy?

How many characters does one space occupy?

A space usually occupies 2 characters, but in some special cases it occupies 3 characters.

In the program, the number of characters occupied by spaces depends on the character set used by the program, such as:

1. When using multi-byte character sets, Half-width spaces occupy 1 byte, and full-width spaces occupy 2 bytes.

2. When using the Unicode character set, half-width spaces occupy 2 bytes, and full-width spaces occupy 2 bytes.

In the file, the number of characters occupied by spaces depends on the encoding used when saving the file. For example:

1. When saving a file with ANSI encoding, half-width spaces Occupies 1 byte, full-width spaces occupy 2 bytes.

2. When saving a UTF8-encoded file, half-width spaces occupy 1 byte, and full-width spaces occupy 3 bytes.

3. When saving a file encoded in Unicode, half-width spaces occupy 2 bytes, and full-width spaces occupy 2 bytes.

How many characters does one space occupy?

Extended information:

ASCII code: One English letter (not case sensitive) occupies one byte of space. A sequence of binary numbers, used as a digital unit in the computer, is generally an 8-bit binary number, converted to decimal. The minimum value is -128 and the maximum value is 127. For example, an ASCII code is a byte.

UTF-8 encoding: One English character is equal to one byte, and one Chinese character (including traditional Chinese) is equal to three bytes. Chinese punctuation occupies three bytes, and English punctuation occupies one byte

Unicode encoding: one English is equal to two bytes, and one Chinese (including traditional Chinese) is equal to two bytes. Chinese punctuation occupies two bytes, and English punctuation occupies two bytes

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of How many characters does one space occupy?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor