There's one additional character that I have discovered which needs to be escaped - ~ (the tilde). I created a text file which includes all low and high ASCII and use this code to process the text:
foreach (char c in pString) {
if (c.ToString() == "(")
SendKeys.SendWait("{(}");
else if (c.ToString() == ")")
SendKeys.SendWait("{)}");
else if (c.ToString() == "^")
SendKeys.SendWait("{^}");
else if (c.ToString() == "+")
SendKeys.SendWait("{+}");
else if (c.ToString() == "%")
SendKeys.SendWait("{%}");
else if (c.ToString() == "~")
SendKeys.SendWait("{~}");
else if (c.ToString() == "{")
SendKeys.SendWait("{{}");
else if (c.ToString() == "}")
SendKeys.SendWait("{}}");
else
SendKeys.SendWait(c.ToString());
}
here's the test text:
the quick brown fox jumped over the lazy dog 123-456-7890 THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG. The quick, brown dog: jumped over the; lazy dog! ¿Did the dog jump? ¡The value was ~200+- – that was a dash ! Of course there is that strange sign under - lowercase - the tilde `. [This is a footnote] but I cannot come up with an excuse for a {curly brace}. Of course, we know that the (left parentheses nor the right parentheses can be ignored). We need to email edgar@something.com to have him send me $1 which is about 50% of the actual value. Obviously there are 3 modifiers which will fail: ^ the caret; + the plus sign; % the percentage sign;. We also need to look at the & ampersand, the * (asterisk) and the _ underscore; then there is the = equal sign and the: colon. What will happen if we insert a tab in the middle of the sentence? Then of course we can have a | vertical bar or a \ back slash not to mention a / forward slash.
The above was all a single line which was followed by a single new line to begin the sentence. Okay, what have I missed I # pound sign
And this starts a new paragraph by saying that after the last utterance. On top of all of that there is the in credible ball of wax that comes after the above which is - at least mostly - "low ASCII" - which covers the opening and closing quotation marks, but not the 'curly' ones - which are apostrophes. Then of course there is the "high ASCII":
€ ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™ š › œ ž Ÿ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ®
¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö ×
Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
not to mention tens, if not hundreds of thousands of Unicode characters!