Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

json encode utf8 error

i have problem encoding this character with json_encode

http://www.fileformat.info/info/unicode/char/92/index.htm

first it give me this error JSON_ERROR_UTF8 which is

'Malformed UTF-8 characters, possibly incorrectly encoded'

so tried this function utf8_encode() before json_encode

now return this result '\u0092'

so i found this one

 function jsonRemoveUnicodeSequences($struct) {
 return preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U1ドル')))", json_encode($struct));
 }

the character show up but with other one

Â’

also tried htmlentities then html_entity_decode

with no result

Answer*

Draft saved
Draft discarded
Cancel

lang-php

AltStyle によって変換されたページ (->オリジナル) /