1

I have a BLOB field in one of tables and I used the following command to convert it to text:

ALTER TABLE mytable
ADD COLUMN field1_new TEXT;

update mytable set
field1_new = CONVERT(field1 USING utf8);

This did not work and gave me some random characters. Like:

9x

This result is returned as a content of message which does not make sense. I changed the character set to 'latin1'. This one gave me a larger sequence of characters yet still something non-sense. For example:

¢xœ}T]k1|/ô?¬Á/‡ZJpMK“–<$„Ô¥ôqO§»ÑI®¤³¹ß...

Is there anyway to figure out what character set the BLOB field is using so that I can convert it to text properly?

Any help with this problem will be much appreciated. Thanks

Edited: I have to also mention that I used CAST command and it returned:

�x�}T]k1|/�?��/��ZJpMK��<$�ԥ�qO���I������������$:���̬�4�...
ahajib
  • 12,838
  • 29
  • 79
  • 120

1 Answers1

2

try using cast:

CAST(field1 AS CHAR(10000) CHARACTER SET utf8)

you can see this post also for more:How do I convert from BLOB to TEXT in MySQL?

Community
  • 1
  • 1
Suchit kumar
  • 11,809
  • 3
  • 22
  • 44