s.decode(utf-8) does not choke if s is already unicode. so we MUST use that allover
This commit is contained in:
		
							parent
							
								
									ede8e3b3cd
								
							
						
					
					
						commit
						84bf980787
					
				
					 2 changed files with 3 additions and 8 deletions
				
			
		| 
						 | 
					@ -1003,7 +1003,7 @@ class GroupchatWindow(chat.Chat):
 | 
				
			||||||
		self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
 | 
							self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
 | 
				
			||||||
		self.childs[room_jid] = self.xmls[room_jid].get_widget('gc_vbox')
 | 
							self.childs[room_jid] = self.xmls[room_jid].get_widget('gc_vbox')
 | 
				
			||||||
		chat.Chat.new_tab(self, room_jid)
 | 
							chat.Chat.new_tab(self, room_jid)
 | 
				
			||||||
		self.nicks[room_jid] = gtkgui_helpers.ensure_unicode_string(nick)
 | 
							self.nicks[room_jid] = nick.decode('utf-8')
 | 
				
			||||||
		self.subjects[room_jid] = ''
 | 
							self.subjects[room_jid] = ''
 | 
				
			||||||
		self.room_creation[room_jid] = time.time()
 | 
							self.room_creation[room_jid] = time.time()
 | 
				
			||||||
		self.nick_hits[room_jid] = []
 | 
							self.nick_hits[room_jid] = []
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,8 +86,8 @@ def reduce_chars_newlines(text, max_chars = 0, max_lines = 0,
 | 
				
			||||||
	If any of the params is not present(None or 0) the action
 | 
						If any of the params is not present(None or 0) the action
 | 
				
			||||||
	on it is not performed
 | 
						on it is not performed
 | 
				
			||||||
	'''
 | 
						'''
 | 
				
			||||||
	# assure that we have only unicode text
 | 
						# make sure that we have only unicode text
 | 
				
			||||||
	text = ensure_unicode_string(text)
 | 
						text = text.decode('utf-8')
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def _cut_if_long(str):
 | 
						def _cut_if_long(str):
 | 
				
			||||||
		if len(str) > max_chars:
 | 
							if len(str) > max_chars:
 | 
				
			||||||
| 
						 | 
					@ -122,11 +122,6 @@ def escape_for_pango_markup(string):
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	return escaped_str
 | 
						return escaped_str
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def ensure_unicode_string(string):
 | 
					 | 
				
			||||||
	if type(string) == str:  
 | 
					 | 
				
			||||||
		return unicode(string, encoding = 'utf-8')  
 | 
					 | 
				
			||||||
	return string
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def autodetect_browser_mailer():
 | 
					def autodetect_browser_mailer():
 | 
				
			||||||
	#recognize the environment for appropriate browser/mailer
 | 
						#recognize the environment for appropriate browser/mailer
 | 
				
			||||||
	if os.path.isdir('/proc'):
 | 
						if os.path.isdir('/proc'):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue