使用 PHP 编码/解码 RTF 数据?

发布于 2024-10-01 11:21:49 字数 690 浏览 1 评论 0原文

我正在编写一个脚本,将一种文件类型转换为另一种文件类型(对于教堂通常使用的某些歌曲演示软件)。我无法从一种文件类型中提取所有歌词和相关数据,现在我需要将其转换为另一个。

另一种文件类型作为 RTF 数据存储在 XML 节点内。例如:

RTFData="e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGY5NDlcY29jb2FzdWJydGY1NDAKe1xmb250dGJsXGYwXGZzd2lzc1xmY2hhcnNldDAgSGVsdmV0aWNhO30Ke1xjb2xvcnRibDtccmVkMjU1XGdyZWVuMjU1XGJsdWUyNTU7fQpccGFyZFx0eDU2MFx0eDExMjBcdHgxNjgwXHR4MjI0MFx0eDI4MDBcdHgzMzYwXHR4MzkyMFx0eDQ0ODBcdHg1MDQwXHR4NTYwMFx0eDYxNjBcdHg2NzIwXHFjXHBhcmRpcm5hdHVyYWwKClxmMFxmczEyMCBcY2YxIFdpdGggZXZlcnkgYnJlYXRoXApXaXRoIGV2ZXJ5IHN0ZXB9"

所以首先,我需要能够解码这些字符串,以便我可以看到它们是如何组装的,但是一旦我弄清楚了,我还需要一种将字符串转换为这种格式的方法。

我在 google 上搜索过,但没有找到使用 PHP 编码或解码 RTFdata 的好解决方案。有什么想法吗?

I'm writing a script that will convert one file type to another (for some song presentation software normally used by churches.) I can not extract all the song lyrics and relevant data from the one file type, now I need to convert it to the other.

The other filetype is stored as RTFdata inside XML nodes. For example:

RTFData="e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGY5NDlcY29jb2FzdWJydGY1NDAKe1xmb250dGJsXGYwXGZzd2lzc1xmY2hhcnNldDAgSGVsdmV0aWNhO30Ke1xjb2xvcnRibDtccmVkMjU1XGdyZWVuMjU1XGJsdWUyNTU7fQpccGFyZFx0eDU2MFx0eDExMjBcdHgxNjgwXHR4MjI0MFx0eDI4MDBcdHgzMzYwXHR4MzkyMFx0eDQ0ODBcdHg1MDQwXHR4NTYwMFx0eDYxNjBcdHg2NzIwXHFjXHBhcmRpcm5hdHVyYWwKClxmMFxmczEyMCBcY2YxIFdpdGggZXZlcnkgYnJlYXRoXApXaXRoIGV2ZXJ5IHN0ZXB9"

So first, I need to be able to decode these strings so I can see how they are assembled, but once I figure that out I also need a way to convert strings into this format.

I've searched around on google but found no good solution for encoding or decoding RTFdata with PHP. Any ideas?

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

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

发布评论

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

评论(2

荒芜了季节 2024-10-08 11:21:49

您拥有的数据是 Base64 编码的。

要获取 RTF 版本,您可以通过 base64_decode 运行它,如下所示:

$rtf = base64_decode($RTFData);

一旦获得该版本,您就可以解释 RTF 数据本身并对其执行您想要的操作。

例如,如果您只想将其转换为纯文本,您可以在此处找到一个 PHP 脚本来执行此操作及其工作原理: http://www.webcheatsheet.com/php/reading_the_clean_text_from_rtf.php

The data you have is base64 encoded.

To get the RTF version, you can run it through base64_decode like this:

$rtf = base64_decode($RTFData);

Once you have that, you can interpret the RTF data itself and do what you want with it.

If you just want to convert it to plain text for example, you can find a PHP script to do this and how it works here: http://www.webcheatsheet.com/php/reading_the_clean_text_from_rtf.php

漫漫岁月 2024-10-08 11:21:49

一些快速谷歌搜索发现了这一点:RTFGen

Some quick Googling turned this up: RTFGen

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