Monday, March 9, 2009

Pay For Yourself Wording

Here

This post may seem off-topic (it is), but I could not resist to put it. Moreover, as we shall see, is not far from track as it seems.

Do this: Open the Windows Notepad. Write in the following text (without pressing return at the end of the line): Here I

 Chinese text 

Save the document with the name you want and exit the Notepad. Now open the document again y. .. Surprise! Everything comes in Chinese! Check.

Although it may seem a easter egg is actually a bug in your notebook. The issue is explained in Wikipedia , and this is where there is a small item in the blog. The issue of different encodings of a file (latin1, utf8, etc.) is a theme that appears frequently latex to migrate documents from one platform to another.

The problem basically comes from a text file "plan" contains no information about what encoding was used by the editor who created it. Given this lack of information, to open the document, the publisher can take different strategies: assume that is widely used as a ODIFICATION can be ISO-8859-1 or Windows-1512, try to "guess" what encoding the file can be used with analysis of the codes contained, or not guess or assume anything, but let the user specify how to interpret the file (either through options or whether reading editor the value of environment variables that specify the user's native language).

In the case of Windows Notepad, the choice is the latter, that is, try to guess the encoding of the file. As we see, the algorithm fails in some cases because the text I've put above, written in Castilian and ASCII encoding, is taken by Chinese text in Unicode. According to Wikipedia, is bug triggered by any short text strings consisting of 4 ASCII ASCII + space + 3 + 3 + space + space + 5 ASCII ASCII. Although, as can be seen, the text that I have found this sequence is not strict and yet also triggers the bug (it seems that the key is the top 4 +3 +3)

Ah, I could not resist translating with Google Chinese text output. He said something like "Brasero very dry, twist retention-Ching Chao", "D

0 comments:

Post a Comment