Skip to content

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte #93

Description

@chenpcpolive-prog
mysql> select version()  ;show create table  all_mysql_types \G;
+------------+
| version()  |
+------------+
| 5.7.44-log |
+------------+
1 row in set (0.00 sec)

*************************** 1. row ***************************
       Table: all_mysql_types
Create Table: CREATE TABLE `all_mysql_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `tinyint_col` tinyint(4) DEFAULT NULL,
  `smallint_col` smallint(6) DEFAULT NULL,
  `mediumint_col` mediumint(9) DEFAULT NULL,
  `int_col` int(11) DEFAULT NULL,
  `bigint_col` bigint(20) DEFAULT NULL,
  `float_col` float DEFAULT NULL,
  `double_col` double DEFAULT NULL,
  `decimal_col` decimal(10,2) DEFAULT NULL,
  `char_col` char(20) DEFAULT NULL,
  `varchar_col` varchar(100) DEFAULT NULL,
  `tinytext_col` tinytext,
  `text_col` text,
  `mediumtext_col` mediumtext,
  `longtext_col` longtext,
  `enum_col` enum('a','b','c','d') DEFAULT NULL,
  `set_col` set('x','y','z','w') DEFAULT NULL,
  `binary_col` binary(20) DEFAULT NULL,
  `varbinary_col` varbinary(100) DEFAULT NULL,
  `tinyblob_col` tinyblob,
  `blob_col` blob,
  `mediumblob_col` mediumblob,
  `longblob_col` longblob,
  `date_col` date DEFAULT NULL,
  `datetime_col` datetime DEFAULT NULL,
  `timestamp_col` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `time_col` time DEFAULT NULL,
  `year_col` year(4) DEFAULT NULL,
  `json_col` json DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COMMENT='MySQL全字段类型测试表'
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql> 
 
[root@ykas-sr-5156 ibd2sql-main]# python3 main.py  ../all_mysql_types.ibd 
Traceback (most recent call last):
  File "main.py", line 178, in <module>
    aa = frm2sdi.MYSQLFRM(FRMFILENAME).get_sdi_page()
  File "/root/cp/recover/ibd2sql-main/ibd2sql/frm2sdi.py", line 133, in __init__
    self._read_columns()
  File "/root/cp/recover/ibd2sql-main/ibd2sql/frm2sdi.py", line 343, in _read_columns
    self.COLUMNS['field'][i]['comment'] = self.read(self.COLUMNS['field'][i]['metadata']['comment_length']).decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
[root@ykas-sr-5156 ibd2sql-main]# 

我建了一张全字段的表,目前检测下来应该是有部分列类弄不兼容,大佬有办法修复么?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions