#456 Bad cutting of subject with multibyte characters

closed-fixed
nobody
5
2010-02-04
2009-07-21
Kepi
No

Function truncateWithEntities is not multibyte aware, it cuts subjects by bytes, not characters, so crippled characters can by shown at end of subject in mailbox view.

I add new function sq_substr_replace and use it insteadof substr_replace and use it in truncateWithEntities

Discussion

  • Kepi
    Kepi
    2009-07-21

    correct patch

     
  • I can confirm that this works OK, thanks.

     
  • Thanks for the contribution. However, this code needs even more cleanup:

    - I don't think sq_strlen() (mb_strlen()) is aware of HTML entities
    - Thus sq_substr_repleace() is not either, although we'll take it anyway
    - I don't think mb_strimwidth() is aware of HTML entities.
    - strpos() is used all over this code, which itself is not multibyte-aware
    - There were some edge cases where the function's logic would fail
    - Japanese language needs additional fixes

    I have attached a new patch that re-writes this function. If you would be so kind as to test it, we'd really appreciate it.

     
  • Thanks for the contribution. However, this code needs even more cleanup:

    - I don't think sq_strlen() (mb_strlen()) is aware of HTML entities
    - Thus sq_substr_repleace() is not either, although we'll take it anyway
    - I don't think mb_strimwidth() is aware of HTML entities.
    - strpos() is used all over this code, which itself is not multibyte-aware
    - There were some edge cases where the function's logic would fail
    - Japanese language needs additional fixes

    I have attached a new patch that re-writes this function. If you would be so kind as to test it, we'd really appreciate it.

     
    • status: open --> pending
     
    • status: pending --> pending-fixed
     
  • qdinar
    qdinar
    2010-02-04

    fixes the bug that i had seen

     
    • status: pending-fixed --> closed-fixed
     
  • Thanks for testing. This will be in 1.4.20.