Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am epheatt on github.
* I am epheatt (https://keybase.io/epheatt) on keybase.
* I have a public key ASBB4ZRHNbeik-lY1A7wwLimV9o75MPNjLFD6-KzkumwVgo
To claim this, I am signing this object:
@epheatt
epheatt / jquery.websafeunicode.js
Created January 29, 2012 04:26
jQuery websafe Unicode
$.fn.websafeUnicode = function(options) {
var ival = $(this).val();
var oval = $.trim(ival);
if( oval.length > 0 ){
//strip iso-8859-1 and windows-1252 control characters
oval = oval.replace(/[\u0081\u008D\u008F\u0090\u009D]/g,'');
//Shift iso-8859-1 and windows-1252 up to unicode websafe equivalents
oval = oval.replace(/[\u0080]/g,'\u20AC'); //euro sign
oval = oval.replace(/[\u0082]/g,'\u201A'); //single low-9 quotation mark
oval = oval.replace(/[\u0083]/g,'\u0192'); //florin currency symbol
@epheatt
epheatt / rtfXmlFormat.cfm
Created January 28, 2012 19:48
RTF escape code for XML entities and all other ASCII characters greater than 128
<cfscript>
function rtfXmlFormat(str){
// Format the following Predefined XML Entities for RTF usage in XML
// " &quot; \u0034
// & &amp; \u0038
// ' &apos; \u0039
// < &lt; \u0060
// > &gt; \u0062
// { \u0123
// } \u0125