0

I'm using phpseclib for encrypting data, My MySQL database's encoding is utf8-general-ci. when I encrypt an string and save it to the table some of characters appears in '?' charachter. This make mistake when I want to decrypt it. What encoding should I use to have all of the characters? please help.

4

1 回答 1

3

如果您将数据加密为二进制字符串,则不能再将其存储在 UTF8 编码字符串中,因为某些二进制值/序列不是有效的 UTF8

只需在存储之前对您的字符串进行 base64 编码(或将列类型更改为二进制类型),事情应该会更好。

于 2013-09-08T10:16:06.457 回答