Vote Details for "I18N_UnicodeString" by hfuecks

» Details
  • Voter: Harry Fuecks 
  • Vote: +1 (not conditional)
  • Reviews: Cursory source review
» Comment
Looks good and certainly something that's badly needed.

One thing that seems a bit of a shame is including PEAR at the start: adds 1000ish lines of code to parse on every request just in case of error (which typically should be uncommon). I guess most users of this will expect a lightweight set of tools, comparable to the native string functions with minimal processing overhead.

A nice way to get around this when raising errors is to conditionally include PEAR on error, rather than at the start e.g.;

} else {
require_once 'PEAR.php';
return PEAR::raiseError('Malformed UTF-8 string');
}

When checking for errors, that's trickier but I imagine users would prefer something more suspect like;

if(strtolower(get_class($this->_unicode))=='pear_error')

given it saves those lines of code.