From 6ec69b0b911569016dad25153565d61ca8894821 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 17 Dec 2011 18:09:51 -0500 Subject: [PATCH] Add Unicode normalization utility function, using NFC Addresses https://www.zotero.org/trac/ticket/865 Need to decide the best place to call this --- chrome/content/zotero/xpcom/utilities_internal.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 7d6a726f25..fdab0c5c3e 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -105,6 +105,18 @@ Zotero.Utilities.Internal = { }, + /** + * Unicode normalization + */ + "normalize":function(str) { + var normalizer = Components.classes["@mozilla.org/intl/unicodenormalizer;1"] + .getService(Components.interfaces.nsIUnicodeNormalizer); + var obj = {}; + str = normalizer.NormalizeUnicodeNFC(str, obj); + return obj.value; + }, + + /** * Display a prompt from an error with custom buttons and a callback */