From 27ffcf240fa918c29703adeea89f29858574a2db Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 20 Mar 2014 15:29:32 -0400 Subject: [PATCH] Fix handling of accents when filtering contacts Fixes #2656 --- NEWS | 1 + UI/Contacts/UIxContactsListActions.m | 2 +- UI/WebServerResources/ContactsUI.js | 28 +++++++++++++--------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 6ff9a1651..9869a38a5 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ Bug fixes - disabled ActiveSync provisioning for now (#2663) - fixed messages move in Outlook which would create duplicates (#2650) - fixed translations for OtherUsersFolderName and SharedFoldersName folders (#2657) + - fixed handling of accentuated characters when filtering contacts (#2656) 2.2.1 (2014-03-07) ------------------ diff --git a/UI/Contacts/UIxContactsListActions.m b/UI/Contacts/UIxContactsListActions.m index c3438d46d..7e631416e 100644 --- a/UI/Contacts/UIxContactsListActions.m +++ b/UI/Contacts/UIxContactsListActions.m @@ -146,7 +146,7 @@ { currentInfo = [currentContactDictionary objectForKey: key]; if ([currentInfo respondsToSelector: @selector (stringByEscapingHTMLString)]) - [currentContactDictionary setObject: [currentInfo stringByEscapingHTMLString] forKey: key]; + [currentContactDictionary setObject: currentInfo forKey: key]; } [newContactsList addObject: currentContactDictionary]; } diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 935daf3c9..d9ad90077 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -76,14 +76,14 @@ function contactsListCallback(http) { row.setAttribute("categories", contact["c_categories"]); row.setAttribute("contactname", contact["c_cn"]); var cells = row.getElementsByTagName("TD"); - $(cells[0]).update(contact["c_cn"]); + $(cells[0]).update(contact["c_cn"].escapeHTML()); cells[0].title = contact["c_cn"]; - $(cells[1]).update(contact["c_mail"]); + $(cells[1]).update(contact["c_mail"].escapeHTML()); cells[1].title = contact["c_mail"]; if (fullView) { - $(cells[2]).update(contact["c_screenname"]); - $(cells[3]).update(contact["c_o"]); - $(cells[4]).update(contact["c_telephonenumber"]); + $(cells[2]).update(contact["c_screenname"].escapeHTML()); + $(cells[3]).update(contact["c_o"].escapeHTML()); + $(cells[4]).update(contact["c_telephonenumber"].escapeHTML()); } } @@ -103,13 +103,13 @@ function contactsListCallback(http) { null, null, row); - cell.update(contact["c_cn"]); + cell.update(contact["c_cn"].escapeHTML()); cell.title = contact["c_cn"]; cell = document.createElement("td"); row.appendChild(cell); if (contact["c_mail"]) { - cell.update(contact["c_mail"]); + cell.update(contact["c_mail"].escapeHTML()); cell.title = contact["c_mail"]; } @@ -117,17 +117,17 @@ function contactsListCallback(http) { cell = document.createElement("td"); row.appendChild(cell); if (contact["c_screenname"]) - cell.update(contact["c_screenname"]); + cell.update(contact["c_screenname"].escapeHTML()); cell = document.createElement("td"); row.appendChild(cell); if (contact["c_o"]) - cell.update(contact["c_o"]); + cell.update(contact["c_o"].escapeHTML()); cell = document.createElement("td"); row.appendChild(cell); if (contact["c_telephonenumber"]) - cell.update(contact["c_telephonenumber"]); + cell.update(contact["c_telephonenumber"].escapeHTML()); } } } @@ -642,15 +642,13 @@ function onConfirmContactSelection(event) { var rows = contactsList.getSelectedRows(); for (i = 0; i < rows.length; i++) { var cid = rows[i].getAttribute("id"); - if (cid.endsWith (".vlf")) { - addListToOpener (tag, Contact.currentAddressBook, - currentAddressBookName, cid); + if (cid.endsWith(".vlf")) { + addListToOpener(tag, Contact.currentAddressBook, currentAddressBookName, cid); } else { var cname = '' + rows[i].readAttribute("contactname"); var email = '' + rows[i].cells[1].innerHTML; - addContact(tag, currentAddressBookName + '/' + cname, - cid, cname, email); + addContact(tag, currentAddressBookName + '/' + cname, cid, cname, email); } }