I realized that in case the user by mistake inserted a blanc space for instance before the coupon code, the coupon was not being redeemed. In order to avoid that, I think it would be good to limit the coupon code textfield size and maxlength to the specified coupon code length. I modified the code in commerce_coupon.checkout_pane.inc and added:

    '#size' => $length,
    '#maxlength' => $length,

to $pane_form['coupon_code'] where $length takes its value from:

$length = variable_get('commerce_coupon_default_code_size', 8);

It looks finally like:

$length = variable_get('commerce_coupon_default_code_size', 8);
  $pane_form['coupon_code'] = array(
    '#type' => 'textfield',
    '#size' => $length, //added
    '#maxlength' => $length, //added
    '#title' => t('Coupon Code'),
    '#description' => t('Enter here your coupon code.'),
  );