在 mysql 导出中将 blob 转换为文本

发布于 2024-08-23 16:36:35 字数 255 浏览 2 评论 0原文

我有一些 blob 数据,例如:

0x3333332c2044e963617269652c20356520e9746167650d0a53742d4c617572656e7420285175e9626563292048344e20334d390d0a

我想将其转换为文本,因为新数据库有文本字段而不是 blob,现在它对一些重音字符造成了麻烦。

某处是否有某种 blob 到字符串转换器?

多谢!

I'd have some blob data such as:

0x3333332c2044e963617269652c20356520e9746167650d0a53742d4c617572656e7420285175e9626563292048344e20334d390d0a

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

晌融 2024-08-30 16:36:35

尝试:

CONVERT(blobname USING latin1)

Try:

CONVERT(blobname USING latin1)
洛阳烟雨空心柳 2024-08-30 16:36:35

这取决于斑点是什么。例如,我处理过一些可以表示为基本 XML 文件的 blob。这些相对容易转换。但是,我处理了其他作为图像文件的 blob。如果您尝试将它们表示为文本,您将丢失数据。

你的斑点里有什么?

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?

随梦而飞# 2024-08-30 16:36:35

但是,如果数据包含简单的字节流(即非结构化数据、文件、音频、视频等),并且您需要将它们表示为纯 ASCII,则可以将其更改为 Base64 字符串。

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.

不离久伴 2024-08-30 16:36:35

使用导出创建新数据库,完成后在表上创建文本列,使用 CONVERT 删除旧列进行更新,如果需要,可以重命名旧列。

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.

少女情怀诗 2024-08-30 16:36:35

如果使用 phpmyadmin,请勾选导出页面底部的“以十六进制表示法转储二进制列(例如,“abc”变为 0x616263)”框。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文