algolia / algolia/algoliasearch-client-php

dealing with indexation errors "json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded "

Open
#753 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
697
Forks
112
PR merge metrics
No merged PRs in 30d

Description

I have had to force usage of `JSON_INVALID_UTF8_IGNORE `as part of `$this->jsonOptions` in order to deal with data possibly faulty data content to index.

Without this option, I was sometimes getting errors during indexation `json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded
`

I did it in `algolia/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php`, line 71 (latest PHP client 4.33)

I believe this should myabe added as a default option or made optional somewhere.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in algolia/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php around line 71 and inspect how $this->jsonOptions is used during indexation. Reproduce the malformed UTF-8 json_encode failure, then verify the chosen handling prevents the reported error while preserving the intended indexing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.