- Issue created by @szloredan
- Merge request !96Issue #3464600: Discards string elements that can't be converted → (Open) created by szloredan
- Status changed to Needs review
4 months ago 7:11am 30 July 2024 - 🇻🇳Vietnam ducviethaboo Ha Noi
I just ran into this issue with myself as well. My site is a multilingual. In case the body contains Japanese characters, something like "役質ド定本イロ統転学ぱ歳" will get the same error. I think the iconv() can be replaced with mb_convert_encoding(). After researching, I found that the two functions have similar functions.
- 🇻🇳Vietnam ducviethaboo Ha Noi
I found the issue why they changed from mb_convert_encoding() to iconv() (https://git.drupalcode.org/project/openai/-/merge_requests/81/diffs?commit_id=999a1d3b2fe30ec2daa6a2a43c38d4fbfe98ea79). But it will cause error in my case like comment in #5.
I resolved this problem by following way:- $dom->loadHTML(htmlspecialchars_decode(iconv('UTF-8', 'ISO-8859-1', htmlentities($text, ENT_COMPAT, 'UTF-8')), ENT_QUOTES)); + $dom->loadHTML(htmlspecialchars_decode(mb_convert_encoding(htmlentities($text, ENT_COMPAT, 'UTF-8'), 'ISO-8859-1', 'UTF-8'), ENT_QUOTES));