#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

     
  • Alexandros Vellis

    I can confirm that this works OK, thanks.

     
  • Paul Lesniewski

    Paul Lesniewski - 2010-01-31

    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.

     
  • Paul Lesniewski

    Paul Lesniewski - 2010-01-31

    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.

     
  • Paul Lesniewski

    Paul Lesniewski - 2010-01-31
    • status: open --> pending
     
  • Paul Lesniewski

    Paul Lesniewski - 2010-01-31
    • status: pending --> pending-fixed
     
  • qdinar

    qdinar - 2010-02-04

    fixes the bug that i had seen

     
  • Paul Lesniewski

    Paul Lesniewski - 2010-02-04
    • status: pending-fixed --> closed-fixed
     
  • Paul Lesniewski

    Paul Lesniewski - 2010-02-04

    Thanks for testing. This will be in 1.4.20.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks