特殊字符^C(ETX)、^B(STX)

1、特殊字符^C(ETX)

From Wikipedia, the free encyclopedia

The End Of Text character (ETX) (hex value of 0x03, often displayed as ^C) is an ASCII control character used to inform the receiving computer that the end of the data stream has been reached. This may or may not be an indication that all of the data has been received.

It is often used as a "break" character (Control-C) to interrupt a program or process. In TOPS-20, it was used to gain the system's attention before logging in.

It is often used in conjunction with Start of text (STX) and Data Link Escape (DLE) e.g. to distinguish frames in the Data link layer.

mIRC uses ETX as the color character escape character.

2、特殊字符^B(STX)

First character of message text, and may be used to terminate the message heading.

3、在vim编辑器中的输入

在插入和替换模式里,以下字符有特殊含义;其它字符被直接插入。要插入这些特殊字符
到缓冲区里,在前面加上 CTRL-V。要插入 字符,使用 “CTRL-V CTRL-@” 或者
“CTRL-V 000”。在有的系统上,你必须使用 “CTRL-V 003” 来插入 CTRL-C。注意: 如果
CTRL-V 被映射,你也许会经常使用 CTRL-Q 来代替 |i_CTRL-Q|。

4、hive中对不可见字符的处理

分号是SQL语句结束标记,在HiveQL中也是,但是在HiveQL中,对分号的识别没有那么智慧,例如:
select concat(cookie_id,concat(‘;’,’zoo’)) from c02_clickstat_fatdt1 limit 2;
FAILED: Parse Error: line 0:-1 cannot recognize input ‘’ in function specification
可以推断,Hive解析语句的时候,只要遇到分号就认为语句结束,而无论是否用引号包含起来。
解决的办法是,使用分号的八进制的ASCII码进行转义,那么上述语句应写成:
select concat(cookie_id,concat(‘\073’,’zoo’)) from c02_clickstat_fatdt1 limit 2;
为什么是八进制ASCII码?
我尝试用十六进制的ASCII码,但Hive会将其视为字符串处理并未转义,好像仅支持八进制,原因不详。这个规则也适用于其他非SELECT语句,如CREATE TABLE中需要定义分隔符,那么对不可见字符做分隔符就需要用八进制的ASCII码来转义。

你可能感兴趣的:(特殊字符^C(ETX)、^B(STX))