RSS 2.0
Atom 0.3
Contact
Blogs
Eric Cherng
Software Engineer
Jun
July 2006
Aug
S
M
T
W
T
F
S
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
Search
Go
Archives
December 2006 (1)
November 2006 (1)
October 2006 (4)
September 2006 (15)
August 2006 (5)
July 2006 (3)
April 2006 (1)
January 2006 (2)
December 2005 (1)
November 2005 (4)
October 2005 (2)
September 2005 (1)
August 2005 (2)
April 2005 (2)
January 2005 (1)
November 2004 (1)
October 2004 (2)
August 2004 (1)
July 2004 (3)
News
Check out my
personal blog here
for more about
technology
,
games
, and much much more!
Post Categories
Development
(rss)
Games
(rss)
Hardware
(rss)
Miscellaneous
(rss)
SharePoint 2007
(rss)
Software
(rss)
Windows Vista
(rss)
Article Categories
Software
Links
Desktop Notes 3.0
Vertigo Public Blogs
These postings are provided "AS IS" with no warranties, and confer no rights.
The contents of this post are my personal opinions and do not necessarily represent my employer's view. In addition, my thoughts and opinions may change over time, so out of date posts do not necessarily reflect my current thoughts and opinions.
July 2006 - Posts
What Time Is It? - The Answer
posted
Monday, July 24, 2006 10:34 AM
So did anyone figure out
What Time Is It
?
Ralph
got it right with
his answer
, although he cheated by using Wikipedia.
The peanut butter and jelly jar with the message is a reference to the "
Peanut Butter and Jelly Time
" song by the Buckwheat Boys and the
dancing banana
phenomenon popularized by the internet. This is
another
one
of those
ongoing
jokes
we have in the office and so that's why there is an unopened jar of peanut butter jelly at my desk.
Now don't eat my PBJ!
with
0 Comments
What Time Is It?
posted
Monday, July 17, 2006 12:00 PM
A couple of weeks ago,
Jeff
brought over a jar of Peanut Butter and Jelly to my desk and wrote this:
Anyone get the reference?
I'll reveal the answer in my next post.
with
6 Comments
Visually Breaking Notepad
posted
Wednesday, July 05, 2006 11:12 AM
Here's an interesting post I stumbled upon made by Michael Kaplan:
http://blogs.msdn.com/michkap/archive/2006/06/14/631016.aspx
After seeing his post, I decided to try it out. Here's screenshots of
Notepad
before and after:
Before:
After:
Interesting. What I did was create the file using Windows Explorer (Right Click, New, Text Document) and then dragged/dropped the file onto Notepad, added the magic text, saved the file, then closed Notepad. Next I reopened Notepad and then dragged/dropped the file back into Notepad. The After screenshot above is what Notepad displayed the second time.
With the Windows XP version of Notepad, Microsoft included an Encoding drop down box in the Save As dialog.
Wondering if this was the problem, I recreated the file with the magic text, but this time using Notepad's Encoding specifically set to ANSI. Nope, no good. The Open dialog showed the file with Unicode Encoding and once again the file opened up with the asian text.
As Michael Kaplan explained in his blog, this is just another case of a problem with the
IsTextUnicode
API.
Because given an input string, we don't know what kind of text it is, we need to call such methods in order to determine the string format. Since the standard char[]* string doesn't have any space to include metadata (ie. the type of encoding the characters use), methods such as IsTextUnicode can only "intelligently" (see the documentation for the API) scan the contents and determine whether the string is Unicode or not. As you can see with these screenshots, the method isn't always right, causing the characters to be interpreted as Unicode and thus displaying the asian characters rather than the western alphabet characters.
Now, if you explicitly save the text as Unicode (ie. UTF-8), Notepad injects the
BOM
characters in the beginning of the file to indicate that the file is Unicode. In this case, there is no confusion over what type of encoding the file is using and thus opens up properly in Notepad. Here's what the files look like in hex:
ANSI file:
Unicode file:
Notice the 0xFFEE characters in front of the Unicode file to indicate the UTF-16 encoding. This also
means
that the file is stored in
little-endian
format.
Curious as to what other programs may be affected, here's some more screenshots of other programs.
A favorite amongst many is
Notepad2:
Before:
After:
Oops, looks like Notepad2 also has this problem. Another editor I like to use is
PSPad
:
Before:
After:
Looks like PSPad escapes unscathed.
Luckily
Visual Studio
doesn't have this problem:
Before:
After:
Nor does
Word Beta 2
:
Before:
After:
with
0 Comments