开发者

Convert blob to text in a mysql export

I'd have some blob data such as:

0x3333332c204开发者_如何学Python4e963617269652c20356520e9746167650d0a53742d4c617572656e7420285175e9626563292048344e20334d390d0a

that I'd like to convert to text because the new database has text field instead of blobs and now it makes trouble with some accentuated characters.

Is there somekind of blob to string converter somewhere?

Thanks a lot!


Try:

CONVERT(blobname USING latin1)


It depends on what the blob is. For example, I've dealt with some blobs that could be represented as basic XML files. Those would have been relatively easy to convert. However, I dealt with other blobs that were image files. If you tried to represent them as text you'd lose data.

What are in your blobs?


Create your new database with your export, once done create your text column on the table, update that using a CONVERT drop the old column, renaming the old one if required.


However if the data contains simple byte stream (that is, unstructured data, files, audio, video, whatever) and you need to represent them as pure ASCII you could change into a Base64 string.


If using phpmyadmin, tick the box that says "Dump binary columns in hexadecimal notation (for example, "abc" becomes 0x616263)" at the bottom of the export page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜