什么`\ x1b(B`做什么?

时间:2016-03-29 08:21:58

标签: python ansi-escape

我是Blessed用户,最近,当我试图找出{ [Error: spawn cmd.exe ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn cmd.exe', path: 'cmd.exe', cmd: 'cmd.exe /s /c "chef-apply azurepro.rb"' } 函数的内容时,我得到了这个输出: term.bold()

我理解\x1b[1m\x1b(B\x1b[m\x1b[1m做了什么,但\x1b[m做了什么?我试过打印它,但它似乎根本没有做任何事情。

提前致谢!

1 个答案:

答案 0 :(得分:1)

控制序列\x1b(B选择默认字符集ASCII。见XTerm Control Sequences

ESC ( C   Designate G0 Character Set (ISO 2022, VT100).
          Final character C for designating 94-character sets.  In this
          list, 0 , A  and B  apply to VT100 and up, the remainder to
          VT220 and up.  The VT220 character sets, together with the
          Portuguese character set are activated by the National
          Replacement Character controls.  The A  is a special case,
          since it is also activated by the VT300-control for British
          Latin-1 separately from the National Replacement Character
          controls.
    ...
            C = B  -> United States (USASCII).

仅在终端被设置为某个其他字符集的情况下提供,例如line-drawingBlessed可能会将此作为\x1b(B\x1b[m的一部分进行检索,例如在

    normal = tigetstr('sgr0')

进一步阅读: