Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Some times in my tools I need to output Cyrillic text via arcpy.AddMessage function.

Previously in 10.0 it was very easy. I had .py file of the tool saved in UTF8 codepage. This code wrote messages in Cyrillic with system locale 'cp1251':

source_message = u'Some Cyrillic text here'
message = source_message.encode('cp1251')
arcpy.AddMessage(message)

But in 10.1 the same piece of code writes <msg>0; to messages.

I have tried several ways of output (utf8, cp1251, unicode) with combinations of saving source .py file in different codepages - no way.

May be anybody faced similar problems in 10.1 ?

PS I am trying to run this tool in ArcCatalog 10.1 sp1

share|improve this question
add comment

1 Answer 1

I have same problem because i'm from Serbia and we also use 'cp1251' for our letters. Try to encode with 'utf-8', and then print it, but just add:

arcpy.AddMessage(unicode(message))
share|improve this answer
1  
Have you tried it in 10.1 ? Because this method works for me too in 10.0 but not in 10.1. –  Alex Markov Dec 6 '12 at 16:45
    
Sorry i didn't try in 10.1. –  Milos Dec 6 '12 at 21:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.