I was using mcrypt to encrypt json_encoded data.

On other side, mycrypt was able to decrpyt data but json_decode was not working. It would throw JSON\_ERROR\_CTRL_CHAR error.

However, without mcrypt, json_decode worked flawlessly.

After some trial and error, I found that applying trim function after decrypting data would let me use json_decode without any issues.

Published on

Previous post: Find Large Directories on AIX

Next post: LeetCode 3. Longest Substring Without Repeating Characters