title: Client side processing with javascript vs server side with mod_perl
body: <p>I have a perl script that converts strings to different encodings, like base64, ASCII or hex (both ways). Now I am writing ajax front end for it, and my question is; if I want to automate the detection of the encoding of the string submitted, is it more efficient to perform regex search on the string submitted with javascript before I send it to the server, or is it faster to leave it for the perl script to figure out what type of string?</p>
  
  <p>To clarify, I am asking which of these two is better:</p>
  
  <ol>
  <li>String submitted</li>
  <li>Javascript detects the encoding</li>
  <li>AJAX submits encoding and the string to perl script</li>
  <li>Perl script returns decoded string  </li>
  </ol>
  
  <p>or</p>
  
  <ol>
  <li>String submitted</li>
  <li>AJAX submits the string to perl script</li>
  <li>Perl script detects encoding and returns decoded string</li>
  </ol>
  
  <p>Is there a particular rule of thumb where this type of processing should be performed, and what do you think is better (meaning faster) implementation?</p>