thanks, I'll have a look. I may not need this after all and take it out
entirely, but if not I'll use the XRegExp


On Sat, Mar 2, 2013 at 6:42 PM, Aurimas Vinckevicius <
notifications@github.com> wrote:

> In chrome/content/zotero/rtfScan.js:
>
> > @@ -167,7 +167,10 @@ var Zotero_RTFScan = new function() {
> >  		// read through RTF file and display items as they're found
> >  		// we could read the file in chunks, but unless people start having memory issues, it's
> >  		// probably faster and definitely simpler if we don't
> > -		contents = Zotero.File.getContents(inputFile).replace(/([^\\\r])\r?\n/, "$1 ").replace("\\'92", "'", "g").replace("\\rquote ", "’");
> > +		// unescape first utf then hexdec characters. E.g. LibreOffice prints both, so we want to get rid of immediately
> > +		// following hexdec when unescaping utf
> > +		contents = Zotero.File.getContents(inputFile).replace(/([^\\\r])\r?\n/, "$1 ").replace("\\'92", "'", "g").replace("\\rquote ", "’").replace(/(\uc\d+)?\\u(\d+)(\\\'..)?(\{.*\})?/g, function(){ return String.fromCharCode(arguments[2])}).replace(/(\uc\d+)?\\\'(..)(\{.*\})?/g, function(){return String.fromCharCode(parseInt(arguments[2], 16))});
>
> Here it is
> https://github.com/slevithan/xregexp/blob/master/README.md#xregexpmatchrecursive
>
> And it's available as of #213<https://github.com/zotero/zotero/issues/213>
>
> Use Zotero.Utilities.XRegExp to access the RegExp object. Everything else
> should be the same as in examples on XRegExp README
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/zotero/zotero/pull/255/files#r3216622>
> .
>



-- 
Sebastian Karcher
Ph.D. Candidate
Department of Political Science
Northwestern University