Skip to:
Content

bbPress.org

Opened 3 weeks ago

Closed 3 weeks ago

#3664 closed defect (bug) (fixed)

Topic title length should check utf-8 encoding

Reported by: r-a-y's profile r-a-y Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6.0
Component: Component - Topics Keywords: has-patch
Cc:

Description

In #3189, topic title length is enforced with mb_strlen( $title, '8bit' ). However we should change the encoding from 8bit to utf-8 instead.

To duplicate this problem, try to post a new topic with the following topic title:

“Let’s try to create a new topic!” This should post correctly because it should

This is under 80 characters, but due to the three quotation characters using unicode and due to the current 8bit encoding check, this will not post as the three quotation characters increases the character count by three. Switching the mb_strlen() encoding to utf-8 works.

See attached patch.

Attachments (1)

3664.01.patch (735 bytes) - added by r-a-y 3 weeks ago.

Download all attachments as: .zip

Change History (3)

@r-a-y
3 weeks ago

#1 @johnjamesjacoby
3 weeks ago

  • Milestone changed from Awaiting Review to 2.7
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#2 @johnjamesjacoby
3 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7397:

Common: Fix incorrect encoding in bbp_is_title_too_long().

This commit changes the way that Forum/Topic/Reply title lengths are calculated, away from 8bit for counting bytes to utf-8 for counting characters.

This change is necessary to allow unicode (multibyte) characters to be more accurately included in the overall length calculation, to better match the intention for this optional limitation.

In trunk, for 2.7.

Props r-a-y.

Fixes #3664.

Note: See TracTickets for help on using tickets.