Click here to Skip to main content
15,887,683 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Adding client validations on run time using jQuery Pin
indian14311-Feb-15 13:11
indian14311-Feb-15 13:11 
Questionpopup box not working Pin
Member 1141289229-Jan-15 10:23
Member 1141289229-Jan-15 10:23 
QuestionListBox Dropdown is displaying items only after blur Pin
indian14328-Jan-15 8:27
indian14328-Jan-15 8:27 
GeneralRe: ListBox Dropdown is displaying items only after blur Pin
jkirkerx29-Jan-15 7:51
professionaljkirkerx29-Jan-15 7:51 
GeneralRe: ListBox Dropdown is displaying items only after blur Pin
indian1433-Feb-15 14:48
indian1433-Feb-15 14:48 
GeneralRe: ListBox Dropdown is displaying items only after blur Pin
jkirkerx4-Feb-15 6:33
professionaljkirkerx4-Feb-15 6:33 
Question(Solved) How to convert Microsoft Word smart tags to normal tags? Pin
samflex23-Jan-15 14:39
samflex23-Jan-15 14:39 
AnswerRe: How to convert Microsoft Word smart tags to normal tags? Pin
Richard Deeming26-Jan-15 2:33
mveRichard Deeming26-Jan-15 2:33 
This might help:

Javascript:
JavaScript
/// Replaces commonly-used Windows 1252 encoded chars that do not exist in ASCII or ISO-8859-1 with ISO-8859-1 cognates.
var replaceWordChars = function(text) {
    var s = text;
    
    // smart single quotes and apostrophe
    s = s.replace(/[\u2018\u2019\u201A]/g, "\'");

    // smart double quotes
    s = s.replace(/[\u201C\u201D\u201E]/g, "\"");

    // ellipsis
    s = s.replace(/\u2026/g, "...");

    // dashes
    s = s.replace(/[\u2013\u2014]/g, "-");

    // circumflex
    s = s.replace(/\u02C6/g, "^");

    // open angle bracket
    s = s.replace(/\u2039/g, "<");

    // close angle bracket
    s = s.replace(/\u203A/g, ">");

    // spaces
    s = s.replace(/[\u02DC\u00A0]/g, " ");

    return s;
}

C#:
C#
public static string ReplaceWordChars(this string text)
{
    var s = text;

    // smart single quotes and apostrophe
    s = Regex.Replace(s, "[\u2018\u2019\u201A]", "'");

    // smart double quotes
    s = Regex.Replace(s, "[\u201C\u201D\u201E]", "\"");

    // ellipsis
    s = Regex.Replace(s, "\u2026", "...");

    // dashes
    s = Regex.Replace(s, "[\u2013\u2014]", "-");

    // circumflex
    s = Regex.Replace(s, "\u02C6", "^");

    // open angle bracket
    s = Regex.Replace(s, "\u2039", "<");

    // close angle bracket
    s = Regex.Replace(s, "\u203A", ">");

    // spaces
    s = Regex.Replace(s, "[\u02DC\u00A0]", " ");

    return s;
}





"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How to convert Microsoft Word smart tags to normal tags? Pin
samflex26-Jan-15 12:49
samflex26-Jan-15 12:49 
QuestionDisplay an InnertDiv when outer Div is hidden Pin
indian14320-Jan-15 8:03
indian14320-Jan-15 8:03 
NewsHow to improve Angular performance using delegated events (iv-on-cmd directives) Pin
Michael Collins - Intervalia20-Jan-15 5:09
professionalMichael Collins - Intervalia20-Jan-15 5:09 
GeneralRe: How to improve Angular performance using delegated events (iv-on-cmd directives) Pin
Richard MacCutchan20-Jan-15 5:47
mveRichard MacCutchan20-Jan-15 5:47 
QuestionOnclick event inside loop/fast clicking Pin
Member 1137830215-Jan-15 10:23
Member 1137830215-Jan-15 10:23 
AnswerRe: Onclick event inside loop/fast clicking Pin
jkirkerx15-Jan-15 10:34
professionaljkirkerx15-Jan-15 10:34 
GeneralRe: Onclick event inside loop/fast clicking Pin
Member 1137830215-Jan-15 11:32
Member 1137830215-Jan-15 11:32 
GeneralRe: Onclick event inside loop/fast clicking Pin
jkirkerx16-Jan-15 6:57
professionaljkirkerx16-Jan-15 6:57 
QuestionTooltip is not closing after the window is closed Pin
indian14314-Jan-15 5:41
indian14314-Jan-15 5:41 
AnswerRe: Tooltip is not closing after the window is closed Pin
jkirkerx15-Jan-15 10:19
professionaljkirkerx15-Jan-15 10:19 
AnswerRe: Tooltip is not closing after the window is closed Pin
jkirkerx15-Jan-15 10:25
professionaljkirkerx15-Jan-15 10:25 
GeneralRe: Tooltip is not closing after the window is closed Pin
indian14320-Jan-15 7:54
indian14320-Jan-15 7:54 
Questionhow do i put an uploaded image in a folder Pin
websource11-Jan-15 12:57
websource11-Jan-15 12:57 
AnswerRe: how do i put an uploaded image in a folder Pin
marmo1211-Jan-15 22:00
marmo1211-Jan-15 22:00 
QuestionJSON data not giving the wanted output Pin
Member 113621248-Jan-15 7:52
Member 113621248-Jan-15 7:52 
AnswerRe: JSON data not giving the wanted output Pin
borchef11-Jan-15 22:00
borchef11-Jan-15 22:00 
QuestionSimple Calculation Question Pin
Ryan McElveen2-Jan-15 11:08
Ryan McElveen2-Jan-15 11:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.