Comments for "I18N_UnicodeString"

» Submit Your Comment
Comments are only accepted during the "Proposal" phase. This proposal is currently in the "Finished" phase.
» Comments
  • Matthias Sommerfeld  [2004-08-03 14:18 UTC]


    looks nice so far, but I noticed a pitfall in your handling of UTF-8. You assume, the maximum length is 3 bytes and your methods are not aware of denying to process wider chars.

    You should either include support for wider chars or at least deny the processing of unsupportedly wide ones.

    An example of handling the mentioned wider char could be found in the Net_IDNA proposal here on this site.

  • Michael Wallner  [2004-08-03 14:27 UTC]

    While I hope that PHP 5.1/5.2 ships with ext/i18n (or whatever it'll be called) it currently lacks *a lot* of I18N support, so this might be a valuable class.

    I'll let the others comment on CS...

    What about a equals(&$I18N_Unicode) method? Doing an return !array_diff($this->_unicode, $I18N_Unicode->_unicode); should be better than $u1->toUtf8String() == $u2->toUtf8String().

    You should consider using a switch(strToUpper($encoding)) in setString() rather than using loads of if(strtoupper()).

    setString() doesn't complain if the encoding isn't recognized.

    You load PEAR.php for error handling, but there's no evidence you do so.

    What about some more methods like lastIndexOf(), subStringReplace(), (toUpper(), toLower() - these might be evil)?

    I18N_UnicodeString might be a better name.