Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我错过了什么来腌制和解开_Python_Unicode_Python 3.x_Marshalling_Unmarshalling - Fatal编程技术网

Python 我错过了什么来腌制和解开

Python 我错过了什么来腌制和解开,python,unicode,python-3.x,marshalling,unmarshalling,Python,Unicode,Python 3.x,Marshalling,Unmarshalling,我正在开发一个Py3k程序,希望能够接受Unicode字符串并对其进行pickle/unpickle 但是,它默认为ASCII编解码器,并抱怨Unicode错误: UnicodeEncodeError: 'ascii' codec can't encode character '\u0161' in position 1442: ordinal not in range(128) args = ('ascii', "Content-Type: text/html\n\n<!D

我正在开发一个Py3k程序,希望能够接受Unicode字符串并对其进行pickle/unpickle

但是,它默认为ASCII编解码器,并抱怨Unicode错误:

UnicodeEncodeError: 'ascii' codec can't encode character '\u0161' in position 1442: ordinal not in range(128) 
      args = ('ascii', "Content-Type: text/html\n\n<!DOCTYPE html>\n<html>\n...ype='submit'>\n </form>\n </body>\n</html>", 1442, 1443, 'ordinal not in range(128)') 
      encoding = 'ascii' 
      end = 1443 
      object = "Content-Type: text/html\n\n<!DOCTYPE html>\n<html>\n...ype='submit'>\n </form>\n </body>\n</html>" 
      reason = 'ordinal not in range(128)' 
      start = 1442 
      with_traceback = <built-in method with_traceback of UnicodeEncodeError object>
UnicodeEncodeError:“ascii”编解码器无法对1442位置的字符“\u0161”进行编码:序号不在范围内(128)
args=('ascii',“内容类型:text/html\n\n\n…ype='submit'>\n\n\n”,1442,1443,“序号不在范围(128)”中)
编码='ascii'
结束=1443
object=“内容类型:text/html\n\n\n\n…ype='submit'>\n\n”
原因='序号不在范围内(128)'
开始=1442
带_回溯=
如何更改编解码器或以其他方式进行更改,以便将从CGI字符串中获取的Unicode值成功地编组并反编组为Unicode字符串

谢谢

--编辑--


源代码位于。

我会尝试显式地将unicode对象传递给pickle.dump(),类似于
pickle.dump(unicode(状态),输出文件)

请显示失败的代码。黑暗中的快照。。。我不需要猜测;我需要知道ASCII编解码器在哪里应用,以及如何应用正确的Unicode编解码器。