This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

stupid I/O question---"8 bit US ASCII"?  RSS feed

 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have much expericence with low level I/O files and I just want to make sure that I'm not assuming something that isn't correct.
I'm assuming that 8 bit US ASCII is just plain text that you could view in any text editor such as notepad or vi. Am I correct?
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ASCII is seven bit, not 8 bit. The eighth bit in each byte is always zero. If a file conforms to ASCII encoding than pretty much any editor will be able to open it. Since ASCII is the basis of almost every character encoding, the editor can even assume that it is some other character encoding at it will work.
If some of those eighth bits are set, then it is no longer ASCII. This is often the case if there are characters such as vowels with diacritical marks or smart quotes. Most editors such as notepad and vi are able to open non-ascii files. Editors usually assume that the character set being used is the character set that is the default for the computer platform. If you know the character encoding of the document, some editors let you specify that when you open the document or otherwise read metadata about the document.
Similarly, Java has methods for opening readers from byte streams that have a known character encoding.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!