Friday November 13, 2009
|
Vanity Foul Dedicated to the wanderings of an egotistical mind. |
|
Sending To 'International' Email Addresses I've spent the better part of this week resolving an issue, whereby a user with an email address at Gmail was unable to subscribe to my employer's offering due to his address containing an accented character: é. The first hurdle was saving the address to our database. The validation routine had a rather simple regular expression that did not account for what I call "high ascii", from the Extended Ascii Codes, specifically up to char 165. A brief research turned up Les Hazlewood's most thorough validator, but even it did not account for high ascii. It only stood to reason that it *must* be possible to email addresses containing umlauts, acutes, and accents, but the relevant specs (namely RFC 822) don't mention them. Finally, in the section on 7-bit vs 8-bit within SendMail's own resources page were references to two other specs. In section 5 of RFC 1891 were instructions on how to escape high ascii characters to meet the requirement that SMTP headers must be in "low ascii" (chars 33 - 126). With that knowledge I was able to modify Mr. Hazlewood's regex, replacing "a-zA-Z" in his patterns with "\\p{L}", so long as each email address was then escaped before being added to the recipient list in a SMTPMessage. I based my escaping code on that provided by eadelarosa, making changes to preserve most of the lower ascii characters for readability:
public static String asciiToHex(String ascii){
StringBuilder hex = new StringBuilder();
for (int i=0; i < ascii.length(); i++) {
char c = ascii.charAt(i);
if ((c > 32 && c < 127) && (c != '+' && c != '=')) {
hex.append(c);
} else {
hex.append("+" + Integer.toHexString(ascii.charAt(i)));
}
}
return hex.toString();
}
I was disappointed to learn that Java's SMTP classes didn't do this work for me, though not terribly surprised. John Cleese is 70! No he isn't. Yes, he is! Do you want an argument or don't you?
(
Oct 27 2009, 12:58:25 PM
)
Entertainment
Permalink
The Meat Vegetables Jen said I had to blog this. Last night I had a repeating dream; I'd wake up and when I fell back asleep the dream would restart. I don't remember details except: the people were vegetables. They germinated and grew in the ground. When they reached maturity they left the ground and moved about in a society. This society realized that in their midst were "vegetables made of meat". Yeah, makes no sense now, but some of the beings that grew in the ground and looked vaguely like asparagus were actually meat. These Meat Vegetables were hunted by the others, to be exterminated. But they couldn't know which of those growing in the ground were Meat or Vegetable. Exploding Pop Entry number 2 in my exploding foods series! A week ago my 14 yr old son and I bottled some home-made root beer and cola. We used the standard recipe found in the flavoring package you can purchase from your local home-brewer store. It warned against using glass bottles, as they may not be able to handle the pressure generated by the yeast used to create carbonation; so we used two-liter bottles as recommended. At approximately 3:45am this morning, one of those plastic two-liter bottles exploded in our kitchen (I believe it was cola). A sprinkle of cola covered everything in the kitchen, including the doorless pantry I built a couple years ago, so that several boxes of food were damp. The cupboards were sprayed, the cabinets were sprayed, the stove was sprayed. Soda pop ran down the cupboards and pooled in pots on the stove and on the countertop. A large puddle formed on the floor under the table where the bottle had sat. The french-press that had sat next to the bottle was flung against the fridge and shattered. A hole was created in the wall next to the table, we're not sure which object created that. Jen and I spent a half hour wiping every surface and toweling the floor, I moved the fridge to get whatever had run under there. After she went to bed I got out the mop and cleaned the floor again before returning to bed at 4:30. The floor wasn't sticky when we got up at 5:45am. I imagine we'll need to give all the cabinets another wipe down tonight, and I'll give the floor another mopping, just to ensure we don't attract ants or other creatures.
(
Sep 08 2009, 08:56:24 AM
)
Personal
Permalink
Building in Surveillance
I'm not dead yet. Echoing Rafe
(
Jul 18 2009, 10:05:30 AM
)
Technology
Permalink
Exploding Soup Did you know ham can explode? I didn't. I heated a 1/2 can of Campbells Chunky Split Pea w/Ham for 1 minute. I then stuck in my spoon, expecting to stir the soup and heat some more. Instead, the bit of ham I touched exploded in my face (leaning into the microwave in order to stir). A big chunk hit my lower lip and burned a spot, but it isn't visibly damaged. Just glad it didn't hit an eye! I cleaned up the interior of the microwave, heated another 15 seconds (originally planned for 45) without incident. Phew! Satellite Sheiks
Isn't that the opposite of Christian televangelists? |
|
||||