Last active
August 29, 2015 14:02
-
-
Save juji/70dab5c8dc1d5afe0936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cleanChar = function(str){ | |
var f = [ | |
String.fromCharCode(8220), //“ | |
String.fromCharCode(8221), //” | |
String.fromCharCode(8216), //‘ | |
String.fromCharCode(8217), //‘ | |
String.fromCharCode(8211), //– | |
String.fromCharCode(8212), //— | |
String.fromCharCode(189), //½ | |
String.fromCharCode(188), //¼ | |
String.fromCharCode(190), //¾ | |
String.fromCharCode(169), //© | |
String.fromCharCode(174), //® | |
String.fromCharCode(8230) //… | |
]; | |
var r = ['"','"',"'","'","-","--","1/2","1/4","3/4","(C)","(R)","..."]; | |
for(var i in f) str = str.replace( new RegExp(f[i],"gi"), r[i] ); | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment