Curly quotes

June 13, 2011

Detect curly quotes with JavaScript

function check_quotes(){
	
	var s = '';
	
	var regex = /\W/g;
	
	var m =  null;
	
	var text = null;
	
	var code = null;
	
	['asset_name','body','summary'].each(function(da_id){
	
		text = document.getElementById(da_id).value; 
		
		m = regex.exec(text);

		if(da_id == 'asset_name'){ da_id = 'title'; }
		
		var count = 0;
		
		while(m){
				
			code = m[0].charCodeAt(0);
			
			if(code > 8200){
			
			    s = s + "\n<li> Found  " + m + "  in " + da_id.split('_').join(' ') + " text</li>";
			    
				count++;
				
			   }

			count++;
 	
			m = regex.exec(text);
		
			}
			
		});
	
	if(s != ''){ poppy('Illegal characters found in your title or description:<br/><br/><ul>' + s + '</ul><br/>Delete and then re-type quotes and long dashes in the editor above before proceeding. Please try and avoid cutting and pasting from Word.'); return true; }
	
	return false;
	
	}

Posted by pj at 04:23 PM | Comments (0)

May 23, 2006

Jython servlet version of AsciiDammit

I've turned AsciiDammit.py into a Jython servlet using Netbeans and Coyote.

Get the source curlyQuoteParser.py or get the .war Quote.war.

You'll need Jython 2.1 in /usr/local/jython-2.1

Posted by pj at 03:39 PM | Comments (0)

May 19, 2006

AsciiDammit.py

Download file

Posted by pj at 10:09 PM | Comments (0)

May 16, 2006

Chris Shiflett: Convert Smart Quotes with PHP

http://shiflett.org/archive/165

Posted by pj at 09:18 AM | Comments (0)

May 15, 2006

Straighten curly quotes in JS

Straighten Smart Quotes

Posted by pj at 07:21 PM

Discussion of curly / smart quotes in XML

XML.com: SVG and Typography: Characters

Posted by pj at 06:57 PM

Curly Quotes

Curling Quotes in HTML, XML, and SGML

Posted by pj at 04:57 PM | Comments (0)