What does `\x1b(B` do?

自闭症网瘾萝莉.ら 提交于 2019-12-08 12:59:39

问题


I'm a Blessed user, and recently, when I tried to find out the contents of the term.bold() function, I got this output: \x1b[1m\x1b(B\x1b[m

I understand what \x1b[1m and \x1b[m do, but what does \x1b(B do? I tried printing it, but it doesn't seem to do anything at all.

Thanks in advance!


回答1:


The control sequence \x1b(B selects the default character set ASCII. See 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).

That is provided just in case the terminal was set to some other character set, e.g., line-drawing. Blessed is probably retrieving this as part of \x1b(B\x1b[m, e.g., in

    normal = tigetstr('sgr0')

Further reading:

  • How do I get color with VT100?
  • VT100.net


来源:https://stackoverflow.com/questions/36279015/what-does-x1bb-do

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