What's the file/group/record/unit separator control characters and its usage?

蓝咒 提交于 2019-12-20 09:11:18

问题


Unicode defines several control characters from ASCII. http://www.unicode.org/charts/PDF/U0000.pdf

I see many control characters are widely used but I really don't see where "information separators" are used. (U+001C~U+001F)

What are them? What's the history of them? Where did they used for?


回答1:


Lammert Bies explains both their usage and the history behind.

28 – FS – File separator The file separator FS is an interesting control code, as it gives us insight in the way that computer technology was organized in the sixties. We are now used to random access media like RAM and magnetic disks, but when the ASCII standard was defined, most data was serial. I am not only talking about serial communications, but also about serial storage like punch cards, paper tape and magnetic tapes. In such a situation it is clearly efficient to have a single control code to signal the separation of two files. The FS was defined for this purpose.

29 – GS – Group separator Data storage was one of the main reasons for some control codes to get in the ASCII definition. Databases are most of the time setup with tables, containing records. All records in one table have the same type, but records of different tables can be different. The group separator GS is defined to separate tables in a serial data storage system. Note that the word table wasn't used at that moment and the ASCII people called it a group.

30 – RS – Record separator Within a group (or table) the records are separated with RS or record separator.

31 – US – Unit separator The smallest data items to be stored in a database are called units in the ASCII definition. We would call them field now. The unit separator separates these fields in a serial data storage environment. Most current database implementations require that fields of most types have a fixed length. Enough space in the record is allocated to store the largest possible member of each field, even if this is not necessary in most cases. This costs a large amount of space in many situations. The US control code allows all fields to have a variable length. If data storage space is limited—as in the sixties—this is a good way to preserve valuable space. On the other hand is serial storage far less efficient than the table driven RAM and disk implementations of modern times. I can't imagine a situation where modern SQL databases are run with the data stored on paper tape or magnetic reels...

A Unit separator could provide essentially the same purpose as a comma in a CSV file or a tab in a tab-delimited file.




回答2:


Did you mean that most of them are usually not used these days? The control characters mostly relate to device control functions, but some of them may have been used as separators in text files. For a quick reference, check my table of C0 Controls.

The information separators have been used to group data in a simple manner, but these days, either binary formats or XML format are used for data organization. There are still curiosities, like the internal use of U+001E and U+001F in Microsoft Word to implement the program’s own idea of “nonbreaking hyphen” and “optional hyphen” (as opposite to Unicode characters for similar purposes). This mainly illustrates that programs can use control characters in weird ways. Problems arise of course if the characters are included in text transmitted to other programs.



来源:https://stackoverflow.com/questions/8695118/whats-the-file-group-record-unit-separator-control-characters-and-its-usage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!