• ResolvedPlugin Contributor sburdett

    (@sburdett)


    Well, I hope I’m not becoming annoying but I am having another problem. I am getting this error when syncing all documents now:

    “Validation error for field ‘post_content’: Invalid codepoint B”

    Have you run into this before?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andrea Landonio

    (@lando1982)

    Hi, never seen before but searching on Google it seems an error that occurs when using UTF-8 characters that are not allowed..

    Plugin Contributor sburdett

    (@sburdett)

    Turns out the issue was Unicode Character ‘LINE TABULATION’ (U+000B). This is a valid UTF-8 Character but not a valid XML Character and therefore not valid for Cloud Search. I Just went through and deleted the offending text from the DB but it would be nice if the plugin could parse for these things and remove or delete them. If it was just this one you could just change this function:

    function acs_put_documents( $docs ) {
        try {
            // Get client
            $client = acs_get_domain_client();
            $docs = json_encode( $docs );
            $docs = str_replace("\u000b","",$docs);
            // Upload documents
            $result = $client->uploadDocuments( array(
                'documents' => $docs,
                'contentType' => 'application/json'
            ) );
    
            // Return result
            return $result->getPath( 'status' ) == 'success';
        }
        catch ( \Exception $e ) {
    	    error_log( __( 'Error uploading documents', ACS::PREFIX ) . ': ' . $e->getMessage() );
    
            return false;
        }
    }

    but I’m guessing there are others that could be an issue. At first, I did this ^ but I don’t like modifying core plugin files so I opted to go back and just delete the offending text and hope it stays gone. It also would be nice if it threw a more visible error if the documents did not sync. For now, it just throws an error to the admin log. Anyway, just some possible future enhancement suggestions and maybe this can help if someone else encounters this error. It took me a long time to figure it out.

    • This reply was modified 7 years, 8 months ago by sburdett.
    Plugin Author Andrea Landonio

    (@lando1982)

    Hello, nice job! It could be a more flexible idea to give users the opportunity to add in the plugin settings page a list of “chars” to replace..

    Now, I’m working on a big extension, but when ready I’ll integrate your code in the plugin, it’s good extension!

    For more info about sync errors.. I’m thinking for what I can do… keep in touch.. 😉

    Thanks a lot!
    Bye

    Plugin Author Andrea Landonio

    (@lando1982)

    Hi Shane,

    invalid chars remove features added to the plugin!
    I’ve added your WordPress user to the contributor of the plugin, nice job! Very appreciated!

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

The topic ‘Validation error for field ‘post_content’’ is closed to new replies.