PostgreSQL copy 时提示:ERROR: invalid byte sequence for encoding "UTF8": 0xb3
invalidpostgresql Error for 提示 quot sequence copy
2023-09-27 14:26:06 时间
测试时使用三种文件格式:
ISO-8859
Netpbm PBM image
ASCII
if [ $(file $filename|grep -c "ISO-8859") -gt 0 ]
then
echo "ISO-8859" psql -c "copy $schemaname.$tbname from '$dirname/$filename' with(format 'csv', delimiter ', encoding 'ISO-8859-1')" $dbname elif [ $(file $filename|grep -c "ASCII") -gt 0 ]
then
echo $format psql -c "copy $schemaname.$tbname from '$dirname/$filename' with(format 'csv', delimiter ', encoding 'UTF-8')" $dbname else psql -c "copy $schemaname.$tbname from '$dirname/$filename' with(format 'csv', delimiter ', encoding 'ISO-8859-1')" $dbname
这种处理方式在文件格式为ASCII时,copy中途仍然会出现编码错误提示。
ERROR: invalid byte sequence for encoding "UTF8": 0xb3
最后摸索发现不管什么格式,都指定为ISO-8859-1就能处理。
全包容的编码格式,都能处理:
psql -c "copy $schemaname.$tbname from '$dirname/$filename' with(format 'csv', delimiter ', encoding 'ISO-8859-1')" $dbname
相关文章
- go编译go-gtk,出现invalid flag in pkg-config --libs: -Wl,-luuid提示
- Invalid bound statement (not found) 问题处理
- 【CUDA开发】 Check failed: error == cudaSuccess (8 vs. 0) invalid device function
- “Invalid maximum heap size” when running Maven
- timestamp Invalid default value
- ValidationError: Invalid options object. Dev Server has been initialized using an options object th
- 已解决org.junit.runners.model.InvalidTestClassError: Invalid test class
- wordpress [ERR] 1067 - Invalid default value for ‘comment_date‘ [ERR] /*
- 【anaconda】处理 WARNING: Ignoring invalid distribution -ip
- dubbo升级到Apache的 2.7.7报错Caused by: java.io.IOException: invalid constant type: 18
- postgresql/lightdb ERROR: invalid byte sequence for encoding "UTF8": 0xc92c与bytea类型
- java.lang.IllegalArgumentException: An invalid domain [.test.com] was specified for this cookie解决方法