# 下划线

下划线是字符“_”，在 Unicode 和 ASCII 中编码为 U+005F LOW LINE，即印在一行文字基线处的水平线。它最初是打字机上的一种装置，通过叠打来为词语画下划线，如今主要用于计算领域，在标识符、文件名以及其他不能包含实际空格的语境中代替空格。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup>

| 关键事实 | 详情 |
|---|---|
| 码位 | U+005F，位于基本拉丁区块；ASCII 十六进制 5F<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[2](https://www.unicode.org/versions/Unicode1.0.0/ch06.pdf)</sup> |
| 正式名称 | LOW LINE；Unicode 1.0 名称为 SPACING UNDERSCORE<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[3](https://www.play.decodeunicode.org/en/u%2B005F)</sup> |
| 一般类别 | 连接符标点，被描述为“一种连接性标点符号，如同连结号”<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[3](https://www.play.decodeunicode.org/en/u%2B005F)</sup> |
| 原始用途 | 打字机叠打：退格回到已打的词上，在其下方打出低线<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[4](https://didyeah.com/facts/an-underscore-began-as-a-typewriter-overstrike-not-a-normal-writing)</sup> |
| 对应字符 | U+203E OVERLINE 是其位于上方的对应字符；两者中任一字符的连续序列都应连成不间断的线<sup>[5](https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf)</sup> |
| 现代用途 | 在编程标识符和文件名中代替空格；在表单和填空文本中作占位符<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup> |
| 搜索引擎建议 | 谷歌建议在 URL 中用连字符而非下划线分隔单词<sup>[6](https://developers.google.com/search/docs/crawling-indexing/url-structure?missing=undefined)</sup> |

## 打字机上的起源

下划线的历史早于计算机。打字机无法打印斜体或粗体字，因此下划线是排字工所用斜体的标准替代方式。方法是叠打：打字员先打出单词，按退格键将字车退回同样的字符位置，再敲下下划线键，使低水平线占据与字母相同的位置。两次独立的敲击由此形成一个带下划线的单词，这一技巧之所以可行，是因为低线的扁平形状与打字机固定的垂直网格相吻合。<sup>[4](https://didyeah.com/facts/an-underscore-began-as-a-typewriter-overstrike-not-a-normal-writing)</sup> 同样的退格加下划线方法一直延续到电动时代：IBM 的 Selectric 机器尽管配有可更换的字球，除退格加下划线外也不提供任何格式功能。<sup>[7](https://dash.harvard.edu/bitstreams/7312037e-72ae-6bd4-e053-0100007fdf3b/download)</sup>

即便在那个时代，这个字符的含义也并不统一。[计算机历史博物馆](https://www.edgepedia.org/zh/computer-history-museum)一份关于字符集标准化的讨论记录指出，在排印中，下划线在美国是表示斜体的惯例，而在意大利则表示粗体，除非它是行末的最后一个字符。<sup>[8](https://archive.computerhistory.org/resources/access/text/2019/03/102785430-05-04-acc.pdf)</sup>

打字机键盘本身很早就进入了计算领域。1956 年 2 月，麻省理工学院的道格·罗斯（Doug Ross）写了一份备忘录，论证 Flexowriter 这种电控打字机可以用作计算机输入设备；1956 年 7 月 4 日，一台键盘作为实验被连接到麻省理工学院旋风（Whirlwind）计算机上。实验成功了，键盘输入由此传播开来，把打字机的字符集——包括下划线——带入了计算领域。<sup>[9](https://www.computinghistory.org.uk/det/6117/First-keyboard-used-to-input-data/)</sup> 一份关于下划线的历史资料指出，打字机之所以被选作早期计算机的输入层，是因为它随手可得、易于连接，且为办公室用户所熟悉，而它的物理限制反过来又塑造了围绕它构建的硬件和程序。<sup>[7](https://dash.harvard.edu/bitstreams/7312037e-72ae-6bd4-e053-0100007fdf3b/download)</sup>

## 编码

U+005F 位于基本拉丁区块，自 Unicode 1.1 版起就是标准的一部分；其 Unicode 1.0 名称为 SPACING UNDERSCORE，后改为 LOW LINE。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[3](https://www.play.decodeunicode.org/en/u%2B005F)</sup> Unicode 1.0 映射表将该字符列在 005F 位置，名称为 SPACING UNDERSCORE。<sup>[2](https://www.unicode.org/versions/Unicode1.0.0/ch06.pdf)</sup> 它的一般类别是连接符标点（Pc），即一类连接词语的字符，并且是 ASCII 标准的一部分，该标准保证其在各计算机系统间表示一致。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup>

Unicode 标准将其视为间距字符，并与 U+203E OVERLINE（位于上方的对应字符）配对，后者不同于 U+0305 COMBINING OVERLINE。与所有上划线和下划线一样，这些字符的连续序列应连成不间断的线。<sup>[5](https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf)</sup> 在 Unicode 的英文版字符注释中，该字符带有“dash”“line”“low”“underdash”“underline”等关键词，其文本转语音名称为“low line”。<sup>[10](https://github.com/unicode-org/cldr/blob/main/common/annotations/en.xml)</sup>

## 在编程中的使用

由于大多数编程语言不允许名称中包含空格，下划线成了标识符中约定俗成的分词符，如 `format_date` 或 `user_name`。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[6](https://developers.google.com/search/docs/crawling-indexing/url-structure?missing=undefined)</sup> C 标准将标识符定义为包含下划线的非数字字符序列，因此 `_` 在 C 名称中是合法字符。<sup>[11](https://citeseerx.ist.psu.edu/document?doi=62aa51488554039c1e8e822bab184c2f860f28e4&repid=rep1&type=pdf)</sup> 在 CSS 中，标识符只能包含字母、数字、U+00A0 及以上的字符、连字符和下划线；标识符也可以以连字符或下划线开头，此类首字符保留给厂商特定的扩展，如 `-moz-box-sizing`，并保证以连字符或下划线开头的名称绝不会用于标准属性或关键字。<sup>[12](https://www.w3.org/TR/CSS21/syndata.html)</sup>

建立在下划线之上的惯例不止于简单的词语连接。在 Sass 中，前导下划线将文件标记为局部文件（partial），这种文件绝不应被编译为独立的 CSS 文件。<sup>[13](https://github.com/bartvandebiezen/file-name-conventions)</sup>

## 文件名与 URL

在文件命名中，下划线充当可读的、不含空格的分隔符。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup> 风格指引因语境而异。谷歌的开发者文档风格指南要求作者在 `query-data.html` 这类文件名中使用连字符而非下划线，理由是搜索引擎会把文件和目录名中的连字符理解为词间空格，而下划线通常不被识别，这可能损害搜索可见度；只有在某个目录已使用下划线、为保持一致性时才允许使用下划线。<sup>[14](https://developers.google.com/style/filenames)</sup>

谷歌的搜索文档对 URL 给出同样的建议，并说明了理由：连字符有助于用户和搜索引擎识别 URL 中的概念，而下划线由于历史原因，通常用来表示应保持在一起的概念，正如编程语言在 `format_date` 这类函数名中的做法。<sup>[6](https://developers.google.com/search/docs/crawling-indexing/url-structure?missing=undefined)</sup> 其他机构则两种字符都接受：[美国图书馆协会](https://www.edgepedia.org/zh/american-library-association)的文件命名规程禁止空格，但允许“下划线（_）或连字符（-）”，同时规定文件夹名只能使用小写字符，且完全不得含空格、连字符或下划线。<sup>[15](https://www.ala.org/support/drupal/attacks)</sup>

## 相关字符与区别

这个字符也保留了它的视觉作用。在纯文本中，它代表表单和填空练习中的空白或占位符，连续的下划线可以在纯文本文档中画出不间断的横线。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup><sup> • </sup><sup>[5](https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf)</sup> 随着打字机的衰落，它失去的是其原始功能：现代文本系统用格式而非打出字符来加下划线，尽管那个曾经用于给文字加下划线的按键仍留在每一台键盘上。<sup>[1](https://www.unicodecharacter.org/u%2B005f)</sup>

## References

1. [U+005F "_" Low Line Unicode Character, unicodecharacter.org](https://www.unicodecharacter.org/u%2B005f)
2. [Unicode Version 1.0, External Mapping Tables (SPACING UNDERSCORE at 005F)](https://www.unicode.org/versions/Unicode1.0.0/ch06.pdf)
3. [_ U+005F, decodeunicode.org](https://www.play.decodeunicode.org/en/u%2B005F)
4. [An underscore began as a typewriter overstrike, DidYeah](https://didyeah.com/facts/an-underscore-began-as-a-typewriter-overstrike-not-a-normal-writing)
5. [The Unicode Standard, Version 16.0, Core Specification](https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf)
6. [URL Structure Best Practices for Google Search, Google Search Central](https://developers.google.com/search/docs/crawling-indexing/url-structure?missing=undefined)
7. [The Origins of the Underline, Harvard DASH](https://dash.harvard.edu/bitstreams/7312037e-72ae-6bd4-e053-0100007fdf3b/download)
8. [Speeches and papers, 1955–1982, Computer History Museum archive](https://archive.computerhistory.org/resources/access/text/2019/03/102785430-05-04-acc.pdf)
9. [First keyboard used to input data, Centre for Computing History](https://www.computinghistory.org.uk/det/6117/First-keyboard-used-to-input-data/)
10. [cldr/common/annotations/en.xml, unicode-org/cldr on GitHub](https://github.com/unicode-org/cldr/blob/main/common/annotations/en.xml)
11. [Programming languages — C (ISO/IEC 9899), CiteSeerX](https://citeseerx.ist.psu.edu/document?doi=62aa51488554039c1e8e822bab184c2f860f28e4&repid=rep1&type=pdf)
12. [CSS 2.1 Specification, section 4.1.2, W3C](https://www.w3.org/TR/CSS21/syndata.html)
13. [file-name-conventions, bartvandebiezen on GitHub](https://github.com/bartvandebiezen/file-name-conventions)
14. [Filenames and file types, Google developer documentation style guide](https://developers.google.com/style/filenames)
15. [Preventing Attacks: File Name Protocols, American Library Association](https://www.ala.org/support/drupal/attacks)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 25, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Oct 25, 2026*

Topic: 社会与历史 › 语言与语言学 › 文字与符号系统 › Punctuation and orthographic marks

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/underscore

English original: https://www.edgepedia.org/underscore
