Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
uuencoding seems like a bit of overkill in order to drop the 8th bit. Here is a much simpler method (well, it is conceptually simpler but Perl's built-in uuencoding makes it harder to code in Perl) that might be much faster. It most likely (depending on the concentration of "8-bit characters") will write more bytes but that might not be much of a problem in comparison to the CPU usage of uuencoding. Then again, encoding perl.exe my way takes a ton fewer bytes than uuencoding does. The concept is to pick two 7-bit characters, $quote7 and $quote8. $quote7 is used to "quote" these two characters. $quote8 is used to "quote" any "8-bit characters". So you replace any 8-bit character with $quote8 followed by that character with the 8th bit stripped. You preceed any occurrances of $quote7 or $quote8 with $quote7. I hope it is obvious how you reverse the process. Here are the conversion routines wrapped in a test program (and it actually works):
I used the hashes in a quest for execution speed but since I didn't run benchmarks I can't guarentee that other methods aren't tons faster. - tye (but my friends call me "Tye")In reply to (tye)Re: ASP and Storable woes
by tye
|
|