[ERROR] IO error while decoding 路径 routes_reverseRouting.scala with UTF-8 问题解决

用play,scala,idea,maven写了一个网页的项目。


之前在ubuntu上的一个项目,用intellij idea开发用maven编译打包没问题。

复制到Windows下尝试编译却出现问题:

[ERROR] IO error while decoding 路径 routes_reverseRouting.scala with UTF-8

Please try specifying another one using the -encoding option

[ERROR] IO error while decoding 路径 routes_routing.scala with UTF-8

Please try specifying another one using the -encoding option


首先我查找网上的资料,网上都说是字符编码的问题,要我把编码从gbk改成utf-8。

有说要改idea右下角的编码的,有说去设置里改项目的编码的。

但是我按照网上的说法去改编码的时候都发现我的编码已经是utf-8了啊。

照着做了一遍都不行。


最后我把conf文件夹下的routes里的注释都去掉,即刻编译成功。

不管别的文件里的注释是否有中文,不需要去掉。

回来有空再加上,不过应该是得加英文的了。


补充:

http://songjianyong.iteye.com/blog/1910143

http://www.cnblogs.com/leipei2352/archive/2011/04/20/2022128.html

在这篇文章里说了,maven在windows系统dos下编译时默认的编码是gbk。

可以按照文章中说的设置maven的默认编码为utf-8来试试。

不过由于我的项目有可能会有别人来修改,所以我maven的设置我并没有改,

这里写出来仅供参考,未验证。


转载请注明出处:

http://blog.csdn.net/thewolf2?viewmode=list

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The error message "'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byte" suggests that there is an issue with decoding a byte sequence as UTF-8 when working with a shapefile using the shapefile library. This error can occur if the shapefile contains non-UTF-8 characters or is encoded in a different encoding that is not compatible with UTF-8. The shapefile library assumes UTF-8 encoding by default when reading attribute data from the .dbf file. To resolve this issue, you can try the following steps: 1. Specify the correct encoding: If you know the encoding of the shapefile, you can specify it explicitly when reading the attribute data. For example, if the shapefile is encoded in Latin-1, you can use the `latin1` encoding: ```python import shapefile with shapefile.Reader("your_shapefile.shp", encoding='latin1') as shp: # Access the attribute data attributes = shp.records() ``` 2. Handle non-UTF-8 characters: If the shapefile contains non-UTF-8 characters, you may need to handle them separately. You can try using a different encoding or apply error handling mechanisms to handle the decoding errors. For example, you can use the `errors='replace'` parameter to replace invalid bytes with a placeholder character: ```python import shapefile with shapefile.Reader("your_shapefile.shp", encoding='utf-8', errors='replace') as shp: # Access the attribute data attributes = shp.records() ``` By specifying the correct encoding or using appropriate error handling mechanisms, you should be able to read the attribute data from the shapefile without encountering the decoding error.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值