Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 767 Bytes

95.md

File metadata and controls

20 lines (12 loc) · 767 Bytes
rank vote view answer url
95 994 1197205 19 url

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)


你应该去读一读 Unicode HOWTO.这是个 very first example.

首先不要用 str 来进行 unicode 到 text/byte 的转换.

取而代之的使用 .encode():

p.agent_info = u' '.join((agent_contact, agent_telno)).encode('utf-8').strip()