
String.prototype.bytes is defined differently than in uc_taxes. This causes issues with uc_taxes when uc_fee is called after.
uc_fee:
String.prototype.bytes = function() {
return Drupal.encodeURIComponent(this).replace(/%../g, 'x').length;
};
uc_taxes:
String.prototype.bytes = function() {
// Drupal.encodeURIComponent() gets around some weirdness in
// encodeURIComponent(), but encodes some characters twice. The first
// replace takes care of those while the second lets String.length count
// the multi-byte characters.
return Drupal.encodeURIComponent(this).replace(/%252[36F]/g, 'x').replace(/%../g, 'x').length;
};
Suggestion: instead of overloading a primitive data type, define a custom function - str2bytes(str)
Comments
Comment #1
mrfelton commentedThis should be fixed in CVS. Re-releasing shortly.