尝试解码数据(导出到MySQL的Abs) [英] trying to decode data (exporting Abs to MySQL)

查看:217
本文介绍了尝试解码数据(导出到MySQL的Abs)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数据库表:

DROP TABLE translation_en_lt;
CREATE TABLE translation_en_lt (
  id INTEGER,
  lt_translation WIDEMEMO BLOBBlockSize 102400 BLOBCompressionAlgorithm ZLIB BLOBCompressionMode 9
);

这是使用AbsManager(绝对数据库管理器,Delphi)生成的。它似乎已过时,然而,语法对当前MySQL无效。然后我有这个数据条目:

Which was generated using AbsManager (Absolute database manager, Delphi). It seem to be outdated however, and syntax is invalid for current MySQL. Then I have this data entry:

INSERT INTO translation_en_lt (lt_translation) values (MimeToBin('cABhAHMAaQBzAGw='));

在AbsManager中正确显示的此行的值为 pasislinkti 。然而, base64_decode('cABhAHMAaQBzAGw =')返回p a s i s l [ base64_encode('pasislinkti')返回 cGFzaXNsaW5rdGk = ]。

The value for this row, as displayed correctly in the AbsManager, is pasislinkti. However, base64_decode('cABhAHMAaQBzAGw=') returns p�a�s�i�s�l [base64_encode('pasislinkti') returns cGFzaXNsaW5rdGk=].

如何从 MimeToBin('cABhAHMAaQBzAGw =')获得'pasislinkti'?它与编码有什么关系,zlib( WIDEMEMO BLOBBlockSize 102400 BLOBCompressionAlgorithm ZLIB BLOBCompressionMode 9 )?

How do I get 'pasislinkti' from MimeToBin('cABhAHMAaQBzAGw=')? Does it have anything to do with the encoding, zlib (WIDEMEMO BLOBBlockSize 102400 BLOBCompressionAlgorithm ZLIB BLOBCompressionMode 9)?

有评论说:


14:24 VoVo64:guy:看起来好像
base64编码的数据实际上是UCS-2
little endian。解码
cABhAHMAaQBzAGw =到HEX导致70
00 61 00 73 00 69 00 73 00 6c

14:24 VoVo64: guy: looks as if the base64 encoded data is actually UCS-2 little endian. decoding cABhAHMAaQBzAGw= to HEX results in 70 00 61 00 73 00 69 00 73 00 6c

我已经尝试过 iconv('UTF-16','UTF-8',base64_decode('cABhAHMAaQBzAGw =')),导致:

Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/ssl/pp.php on line 2 pasis

我也尝试过: mb_convert_encoding($ u,'UCS-2LE','UTF- 8'),mb_convert_encoding($ u,'UCS-2','UTF-8');没有工作。

I have also tried: mb_convert_encoding($u, 'UCS-2LE', 'UTF-8'), mb_convert_encoding($u, 'UCS-2', 'UTF-8'); neither didn't work.

推荐答案

这些是Base64字符串:

These are Base64 strings:

cABhAHMAaQBzAGw= -> pasisl
cGFzaXNsaW5rdGk= -> pasislinkti

我认为你的数据在某处被截断。您应该在数据库系统中查找MimeToText()函数。我尝试将数据转储到CSV和加载到MySQL中使用 LOAD DATA INFILE 。您可能必须手动重写表模式。 BLOBBlockSize ....似乎是用于压缩此数据。你的新表将需要更多的空间,或者你可以看看使用MySQL的Compress()函数。

I think your data is being truncated somewhere. You should look for a MimeToText() function in your database system. I'd try to dump the data out to CSV and load that in MySQL using LOAD DATA INFILE. You will probably have to rewrite the table schemas by hand. The BLOBBlockSize.... appears to be for compression of this data. Your new table will take a little more space or you can look into using MySQL's Compress() function.

这样应该可以工作:

CREATE TABLE translation_en_lt (
  id INTEGER, 
  lt_translation MEDIUMTEXT, 
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

这篇关于尝试解码数据(导出到MySQL的Abs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆