• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

\b backspace character use

 
Ranch Hand
Posts: 41
1
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when running the code below in the Python IDLE Shell I get a small white vertical rectangle where the backspace character is. Why is this? I thought that the \b character moved text to the left. In Spyder development environment I get Adc. Could somebody explain in layman terms why this is happening? Thank in advance.  

 
Saloon Keeper
Posts: 28663
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Backspace is a control character. What that actually means is that it indicates that a hardware control operation is to be performed — if the hardware supports it.

On old-fashioned typewriter-style devices, BS would cause the type carrier to physically move 1 space back, and was often used to overtype text, either to make text bolder or to create special characters, like umlauts over vowels and overstrikes/underlines. This was also often done on character printers such as dot-matrix printers.

On CRTs, a backspace moved the character cursor back one space. Most CRTs could not "overtype", so the next output character would simply replace the previous character on the display.

Modern-day outputs are a bigger problem, though. Proportional fonts are common and you cannot simply "back up 1 space" when a "W" and an "I" take up different amounts of horizontal space.

So what you actually have here is that instead of using the BS character to control hardware, the display device is attempting to render that character code (0x08) as a displayable character. Since almost no fonts define character glyphs for control characters, the "no glyph available" glyph is rendered. Typically that glyph will be a hollow rectangular box or a vertical line of some sort.
 
Martin Gerard
Ranch Hand
Posts: 41
1
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the explanation Tim. Much appreciated.
reply
    Bookmark Topic Watch Topic
  • New Topic