<pedrocorreia.net ⁄>
 

<The "bush hid the facts" bug in Notepad explained ⁄ >




clicks: 11117 11117 2006-11-17 2006-11-17 goto entretenimento myNews entretenimento  Bookmark This Bookmark This


1. Load Notepad in Windows (in my case XP Pro)

2. Type "bush hid the facts" (all in lowercase, no quotes)

3. Save this file under a name of your choice

4. Re-open the file

you will not see the text that you typed, but instead you will see a bunch of squares (or, as I later found out, some Chinese characters - that is, if you have the Chinese fonts installed, which is not my case).

Most people think it's a Windows Notepad easter egg (I thought so myself, to be honest), but in fact, it isn't. It's just a lousy Notepad bug. Let me explain...

I was myself curious about the cause of this phenomenon, and I found out that this text is not the only one to cause problems. There are other strings that cause Notepad to screw up, including "this app can break", which was another version of the bug that generated a lot of buzz. I've personally tested a series of strings that have the same effect, including "this api can break", "this cat can split", "jane can not dance", "text wit hou tcaps" and even "abcd efg hij klmno" and "xxxx xxx xxx xxxxx". What do these phrases have in common? They are made up by four words made up by four, three, three and five letters, all lowercase. So, by induction, all "4-3-3-5" strings should work.

Now, let's get to why this thing happens. First of all, it seems that Notepad writes the files just fine, it just can't read them again correctly. As a proof, try opening your saved file, the one that Notepad screws up, with another text editor. I used EditPlus and it turned out to be OK. So why the Notepad thing then? Well, it's a Windows thing. Notepad uses a Windows function that allows it to figure out whether a text file is Unicode or not. And that function, my friends, is the one that screws it up. Because the way it checks can easily be described as "guessing". And it guesses that the file is actually Unicode, and not Ascii, as it is supposed to be.

Now, two different but similar explanations can be given.

The first is that, after the ASCII-to-hex conversion of the string, Notepad rearranges the hex codes not according to ASCII standards, but to Unicode, and that messes it up. Here's the example:

Take "bush hid the facts". The hex codes (they can be seen with any hex editor you want to download) for the string are:

62 75 73 68 20 68 69 64 20 74 68 65 20 66 61 63 74 73

Arrange the codes to make up Unicode characters and you get:

7562 6873 6820 6964 7420 6568 6620 6163 7473

You'll notice that every code is hyperlinked. If you click on each one of them, you'll see that each one represents a Chinese (I think) "letter".

So this whole thing's cause is the coincidence that the 18 ASCII characters happen to represent 9 Unicode characters. And, of course, Windows' inability to determine the right encoding of the file.



este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:

http://www.steady-rollin.com/content/view/20/




Subscribe News RSS  Subscribe News Updates by E-mail





myNews <myNews show="rand" cat="entretenimento" ⁄>

7 Longest Roads in the World

Road trips are an iconic part of the American experience. Despite the ease and speed of air travel, (...)

clicks: 6985 6985 2011-03-01 2011-03-01 goto url (new window) interbent.com/7... goto myNews entretenimento


30 Most Amazing Shots Captured Photography in 2010

There're thousands of photographs you have seen in 2010. By Splitting into distinct categories, this (...)

clicks: 8617 8617 2010-11-23 2010-11-23 goto url (new window) smashinghub.com... goto myNews entretenimento


17 Amazing/Beautiful Examples Of Origami Art

The other day, we did a post on 16 Origami tutorials, which were easy and fun. This time, this list (...)

clicks: 7522 7522 2010-06-05 2010-06-05 goto url (new window) listfied.com/17... goto myNews entretenimento


As Lost Ends, Creators Explain How They Did It, What's Going On [Spoilers]

The series endured thanks to the power of faith (coincidentally, a theme of the show) and a more mod (...)

clicks: 7135 7135 2010-05-21 2010-05-21 goto url (new window) wired.com/magaz... goto myNews entretenimento


9 Strong Reasons To Eat Slowly

I like chocolate candies a lot. Most of the time I have to eat 3 candies to be totally pleased. But (...)

clicks: 7337 7337 2010-04-17 2010-04-17 goto url (new window) healthassist.ne... goto myNews entretenimento


World's Most Stunning Data Centers

Who says technology can't be art? These pictures show you some of the most impressive data centers o (...)

clicks: 8027 8027 2010-04-12 2010-04-12 goto url (new window) allamerican.yra... goto myNews entretenimento


Universal truths

1) Triangular sandwiches taste better than square ones. 2) At the end of every party there is alway (...)

clicks: 4232 4232 2008-03-06 2008-03-06 goto url (new window) boreme.com/bore... goto myNews entretenimento


(...)

clicks: 4174 4174 2007-10-29 2007-10-29 goto url (new window) portugaldiario.... goto myNews entretenimento