     return value
 
   clean: (str) ->
-    Zotero.Utilities.removeDiacritics(str || '').replace(@unsafechars, '').trim()
+    @safechars(Zotero.Utilities.removeDiacritics(str || '')).trim()
+
+  safechars: (txt) ->
+    return Zotero.Utilities.XRegExp.replace(text, @unsafechars, '', 'all')
 
   words: (str) ->
     return (@clean(word) for word in @stripHTML(str).split(/[\+\.,-\/#!$%\^&\*;:{}=\-\s`~()]+/) when word != '')

  concat: (pattern) ->
    result = (@reduce(part) for part in pattern)
    result = (part for part in result when part)
    return result.join('').replace(/\s/g, '').trim()

  reduce: (step) ->
    value = @methods[step.method].apply(@, step.arguments)

class BetterBibTeXPatternFormatter
  constructor: (@patterns) ->

  unsafechars: Zotero.Utilities.XRegExp('[^-\\p{L}0-9_!\$\*\+\.\/;\?\[\]]', 'g')
  punct: Zotero.Utilities.XRegExp('\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}', 'g')
  caseNotUpperTitle: Zotero.Utilities.XRegExp('[^\\p{Lu}\\p{Lt}]', 'g')
  caseNotUpper: Zotero.Utilities.XRegExp('[^\\p{Lu}]', 'g')

  format: (item) ->
    @item = Zotero.BetterBibTeX.serialized.get(item)
