• There is problem with wrong character count for minlength and maxlength attribute.

    Single quotes and double quotes on esc_html converts to 4-5 length value and as final result you only able to type much less than the real count indicator value.

    Right before count function should contain something like this (if the count is on php side, of course):

    mb_strlen(html_entity_decode($string, ENT_QUOTES))

    How can I fix this?

    https://ww.wp.xz.cn/plugins/contact-form-7/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    The character count is applied to plain text before it’s escaped with esc_html, so you don’t need to decode entities.

    Thread Starter esemlabel

    (@esemlabel)

    Thanks for reply.

    So why it is wrong counting?

    Try to fill to full texarea with some text with quotes when maxlength parameter is active. You will see the issue.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thanks. I confirmed the issue. I need to find out why it gives wrong counts.

    Thread Starter esemlabel

    (@esemlabel)

    Some thoughts about..

    After adding html_entity_decode to ‘wpcf7_count_code_units’ function for testing purpose I get an error.

    PHP Warning: mb_strlen(): Unknown encoding "3" in \contact-form-7\includes\functions.php on line 333

    Looks like it DOES encoding quotes while counting. Or not?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Wrong character Count when quotes present’ is closed to new replies.