MySQL 中的 AES_DECRYPT() 和 AES_ENCRYPT() 带有波兰语字符
我有一个 MySQL 数据库,它被配置为接收带有波兰语字符(例如 ą、ę、ó、ł、ń 等)的数据.
I have a MySQL database which is configured to receive a data with polish characters (f. ex ą, ę, ó, ł, ń etc.).
现在我想使用 AES_ENCRYPT()
将带有这些波兰语字符的数据发送到数据库,然后使用 AES_DECRYPT()
从那里获取它们.我的问题是我在 C# 中收到一个 byte[] 数组,它有 X 个元素,其中 X 是我收到的文本长度.每个数组元素都有一个它所代表的字符的 ASCII 码.我可以使用编码类轻松地将其转换为文本,但我不会在输出文本中获得波兰语字符.
Now I want to send data with these Polish characters to a db using AES_ENCRYPT()
, and then get them from there using AES_DECRYPT()
.
My problem is that I receive a byte[] array in C# which has X elements where X is length of text I receive. And every single array element has an ASCII code of an character it represents. I could easily convert it to text using Encoding Class, but I won't get Polish characters in output text.
F.例如:
我将 AES_ENCRYPT('ąąą', '123')
发送到数据库.我得到 AES_DECRYPT('sql command','123')
并且我得到 byte[]
有 3 个元素,每个人都有 '97' 值代表 'aaa'
- 不是 'ąąą'
.如何使用 AES_DECRYPT/ENCRYPT
以允许我向我的数据库发送/获取波兰语字符的方式?!或者如何从 aes_decrypt() 而不是 byte[] 获取字符串输出?
I send AES_ENCRYPT('ąąą', '123')
to db.
I get AES_DECRYPT('sql command','123')
and I get byte[]
which has 3 elements, everyone with '97' value which represents 'aaa'
- NOT 'ąąą'
.
How to use AES_DECRYPT/ENCRYPT
in a way which allows me to send/get polish characters to my DB?!
Or how to get string output from aes_decrypt() instead byte[]?
使用编码进行转换可能对您有所帮助.
convert using encoding might help you.
select convert(aes_decrypt(aes_encrypt('ąąą', 'abcdefg'), 'abcdefg') using UTF8);