ensure unicode string func and using it in one more place
This commit is contained in:
		
							parent
							
								
									cfe99c0a4f
								
							
						
					
					
						commit
						58149b4810
					
				
					 2 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1003,7 +1003,7 @@ class GroupchatWindow(chat.Chat):
 | 
			
		|||
		self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
 | 
			
		||||
		self.childs[room_jid] = self.xmls[room_jid].get_widget('gc_vbox')
 | 
			
		||||
		chat.Chat.new_tab(self, room_jid)
 | 
			
		||||
		self.nicks[room_jid] = nick
 | 
			
		||||
		self.nicks[room_jid] = gtkgui_helpers.ensure_unicode_string(nick)
 | 
			
		||||
		self.subjects[room_jid] = ''
 | 
			
		||||
		self.room_creation[room_jid] = time.time()
 | 
			
		||||
		self.nick_hits[room_jid] = []
 | 
			
		||||
| 
						 | 
				
			
			@ -1086,7 +1086,7 @@ class GroupchatWindow(chat.Chat):
 | 
			
		|||
				return
 | 
			
		||||
			room_jid = self.get_active_jid()
 | 
			
		||||
			nick = model[iter][1]
 | 
			
		||||
			if nick != 'moderator' and nick !='participant' :
 | 
			
		||||
			if nick != 'moderator' and nick != 'participant':
 | 
			
		||||
				account = self.account
 | 
			
		||||
				
 | 
			
		||||
				img = model[iter][0]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,8 +87,7 @@ def reduce_chars_newlines(text, max_chars = 0, max_lines = 0,
 | 
			
		|||
	on it is not performed
 | 
			
		||||
	'''
 | 
			
		||||
	# assure that we have only unicode text
 | 
			
		||||
	if type(text) == str:
 | 
			
		||||
		text = unicode(text, encoding='utf-8')
 | 
			
		||||
	text = ensure_unicode_string(text)
 | 
			
		||||
		
 | 
			
		||||
	def _cut_if_long(str):
 | 
			
		||||
		if len(str) > max_chars:
 | 
			
		||||
| 
						 | 
				
			
			@ -123,6 +122,10 @@ def escape_for_pango_markup(string):
 | 
			
		|||
	
 | 
			
		||||
	return escaped_str
 | 
			
		||||
 | 
			
		||||
def ensure_unicode_string(string):
 | 
			
		||||
	if type(string) == str:  
 | 
			
		||||
		return unicode(string, encoding = 'utf-8')  
 | 
			
		||||
 | 
			
		||||
def autodetect_browser_mailer():
 | 
			
		||||
	#recognize the environment for appropriate browser/mailer
 | 
			
		||||
	if os.path.isdir('/proc'):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue