blino's website

Free software developer and more

My computer keeps crashing because of some hardware issue, which is not really nice when I'm typing long messages on Facebook. It would have been quite painful to lose the hundreds of words just waiting to be submitted.

Mozilla Firefox has a nice session store feature, which constantly saves open tabs as well as data in forms, allowing to restore them easily after a crash.

But somehow, my saved form was not restored correctly, while it was present in the ~/.mozilla/firefox/*/sessionstore.js session state file. Fortunately, I was able to find the form content in the sessionstore.bak file. Though, my writing was URI-encoded (RFC 2396) in the state file, it required some trickery to paste back in the Firefox form.

Thanks to the encode and decode url strings Perl howto, I found the URI::Escape module that can decode such strings. It worked almost out of the box, I just needed an additional call to utf8::decode to handle the UTF8 characters:

$ perl -MURI::Escape -Mutf8 -e 'my $s = uri_unescape(<>); utf8::decode($s); print $s'
j'ai%20mang%C3%A9%20une%20ch%C3%A2taigne

j'ai mangé une châtaigne


Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)