سؤال

I got some varbinary(24) data in my mysql row, and I want to convert it into normal text and vice versa , the important thing is that varbinary contains special (Polish ąśżćęł) characters, and they can not be lost during convering the data.

How it can be done?

Varbinary example field example:

bfebb1e2c0c720b8c1c5e420202020202020202020202020
هل كانت مفيدة؟

المحلول

Usually this can be done using CONVERT when you know the original chartset:

mysql> SELECT
    ->   CONVERT(x'ece0ece020ecfbebe020f0e0ecf320202020202020202020'
    ->           USING cp1251) as s;
+--------------------------------------+
| s                                    |
+--------------------------------------+
| мама мыла раму                       |
+--------------------------------------+
1 row in set (0.01 sec)

But I failed to find a chartset to decode bfebb1e2c0c720b8c1c5e420202020202020202020202020 to anything human readable.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top