|
@@ -1,9 +1,9 @@
|
|
|
package com.alibaba.otter.canal.example;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.commons.lang.SystemUtils;
|
|
@@ -254,7 +254,17 @@ public class AbstractCanalClientTest {
|
|
|
protected void printColumn(List<Column> columns) {
|
|
|
for (Column column : columns) {
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
- builder.append(column.getName() + " : " + column.getValue());
|
|
|
+ try {
|
|
|
+ if (StringUtils.containsIgnoreCase(column.getMysqlType(), "BLOB")
|
|
|
+ || StringUtils.containsIgnoreCase(column.getMysqlType(), "BINARY")) {
|
|
|
+ // get value bytes
|
|
|
+ builder.append(column.getName() + " : "
|
|
|
+ + new String(column.getValue().getBytes("ISO-8859-1"), "UTF-8"));
|
|
|
+ } else {
|
|
|
+ builder.append(column.getName() + " : " + column.getValue());
|
|
|
+ }
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ }
|
|
|
builder.append(" type=" + column.getMysqlType());
|
|
|
if (column.getUpdated()) {
|
|
|
builder.append(" update=" + column.getUpdated());
|