相关疑难解决方法(0)

UnicodeEncodeError:'ascii'编解码器无法对位置0中的字符u'\ xef'进行编码:序数不在范围内(128)

我想解析我的XML文档.所以我存储了我的XML文档,如下所示

class XMLdocs(db.Expando):  
   id = db.IntegerProperty()    
   name=db.StringProperty()  
   content=db.BlobProperty()  
Run Code Online (Sandbox Code Playgroud)

现在我的下面是我的代码

parser = make_parser()     
curHandler = BasketBallHandler()  
parser.setContentHandler(curHandler)  
for q in XMLdocs.all():  
        parser.parse(StringIO.StringIO(q.content))
Run Code Online (Sandbox Code Playgroud)

我收到了以下错误

'ascii' codec can't encode character u'\xef' in position 0: ordinal not in range(128)
Traceback (most recent call last):  
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 517, in __call__
    handler.post(*groups)   
  File "/base/data/home/apps/parsepython/1.348669006354245654/mapreduce/base_handler.py", line 59, in post
    self.handle()   
  File "/base/data/home/apps/parsepython/1.348669006354245654/mapreduce/handlers.py", line 168, in handle
    scan_aborted = not self.process_entity(entity, ctx)   
  File "/base/data/home/apps/parsepython/1.348669006354245654/mapreduce/handlers.py", line 233, in process_entity
    handler(entity)   
  File "/base/data/home/apps/parsepython/1.348669006354245654/parseXML.py", line 71, in process
    parser.parse(StringIO.StringIO(q.content))   
  File …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine xml-parsing

73
推荐指数
6
解决办法
20万
查看次数

标签 统计

google-app-engine ×1

python ×1

xml-parsing ×1