This question has already been answered:

I do this:

# -*- coding: utf-8 -*- import arcpy, os, sys reload(sys) sys.setdefaultencoding('utf-8') print "++++++++++++++++++++++" print u"03_Развитие_информационных_систем".decode("utf8") print "++++++++++++++++++++++" 

I tried this:

 print "++++++++++++++++++++++" print u"03_Развитие_информационных_систем" print "++++++++++++++++++++++" 

As a result, I get on the console: 03_D D°D·D²D,Ñ,D,Dµ_D,D½Ñ,D_Ñ?D¼D°Ñ+D,D_D½D½Ñ<Ñ._Ñ?D,Ñ?Ñ,DµD¼

I tried the same way:

 # -*- coding: utf-8 -*- import arcpy, os, sys reload(sys) sys.setdefaultencoding('cp866') print sys.getdefaultencoding() print u"03_Развитие_информационных_систем".decode('UTF-8').encode('cp866') 

It also did not help.

Python 2.7 Windows 7 ENG

Reported as a duplicate by jfs , aleksandr barakin , Alex , user194374, Denis Bubnov on Dec 1 '16 at 8:21 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Your utf-8 is interpreted as being close to iso-8859-1 / cp1252. How to solve, see the link above. - jfs

1 answer 1

Simply

 # -*- coding: utf-8 -*- print u"03_Развитие_информационных_систем".encode('cp866') 

And do not touch sys.setdefaultencoding() .