Support » Plugin: WP User Manager - User Profile Builder & Membership » username length and UTF8

  • Resolved missveronica


    You must use the PHP function mb_strlen to get username length for UTF8 characters and not strlen as UTF8 use 2 bytes for local characters.

    strlen will return the result 6 characters for this string åäö
    and mb_string will return 3.


    lines 28/30

    		$username   = $values['register']['username'];
    		$min_length = wpum_get_option( 'username_min_length' );
    		$max_length = wpum_get_option( 'username_max_length' );
    		$length     = mb_strlen( $username );

    Plugin: WPUM Username Length version 2.0.0

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Alessandro Tesoro


    Hi @missveronicatv

    Thanks for pointing this out, I’ll release a proper fix into the next update, also note that mb_strlen isn’t automatically installed on all servers that come with php.


    (PHP 4, PHP 5, PHP 7)

    function_exists — Return TRUE if the given function has been defined

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘username length and UTF8’ is closed to new replies.