Support

Account

Home Forums Bug Reports Invisible characters returned from text field input

Solved

Invisible characters returned from text field input

  • Hi,

    Version 5.5.14

    Other than rendering the values of text fields on web pages, I sometimes use them to control the flow of my program. It seems that the string returned of the text field have invisible characters. Trimming alone doesn’t do the job and have to strip_tag them.

    $cSnippet = trim(get_field('vSnippet_name', $cObjectID));
    echo 'vSnippet: ' . $cSnippet . '<br>';
    echo 'String length:' . strlen($cSnippet) . '<br>';	
    echo 'String length:' . strlen('thisisplaintext') . '<br>';	        
    if ($cSnippet == 'thisisplaintext') {echo "match";};
    
    $cSnippet = trim(strip_tags(get_field('vSnippet_name', $cObjectID)));
    echo 'vSnippet: ' . $cSnippet . '<br>';
    echo 'String length:' . strlen($cSnippet) . '<br>';	
    echo 'String length:' . strlen('thisisplaintext') . '<br>';	        
    if ($cSnippet == 'thisisplaintext') {echo "match";};

    Results:

    vSnippet: thisisplaintext
    String length:113
    String length:15
    vSnippet: thisisplaintext
    String length:15
    String length:15
    match

    `

  • I just ran the same test on with a text field and I’m not getting any extra content stored. So the question is, where is the extra content coming from? ACF is not adding it.

    The first step is to see what my be causing it by deactivating plugins and switching themes.

  • This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Invisible characters returned from text field input’ is closed to new replies.