Tag Archives: microsoft windows

How to Flush the Windows DNS Cache CodeUnit 21 JAN 2013

Quite often you can resolve web connection issues by flushing your possibly corrupted or out of date system DNS cache. To flush the DNS cache whilst using Microsoft Vista, Windows 7 or Windows 8 is relatively trivial, making use of the standard ipconfig executable.

First, we need to open a command prompt running under Administrator rights:

  1. Click the Microsoft Start Button in the bottom left corner of the screen
  2. Click All Programs
  3. Click Accessories
  4. Right-click on Command Prompt
  5. Select Run As Administrator

In the command window type the following and then hit enter:

ipconfig /flushdns

If everything runs correctly, you should see the following confirmation:

Windows IP Configuration Successfully flushed the DNS Resolver Cache

Nifty.

PHP: Handle Microsoft Windows Smart Quotes in Your Strings CodeUnit 04 JUL 2011

Microsoft Word likes converting single and double quotes into it’s so-called smart quotes representation, which can be annoying when you are trying to display the string on a device that doesn’t support smart quotes (the curly ones in case you were wondering). The easiest way to clean out these curly smart or fancy quotes is to run a simple search and replace on your string:

 $text = "string containing Microsoft Smart Quotes...";
 $chrs = array (chr(150), chr(147), chr(148), chr(146));
 $repl = array ("-", """, """, "'");
 $text = str_replace($chrs, $repl, $text);

And now you know.

PHP: How to Gracefully deal with some Microsoft Windows Special Characters CodeUnit 22 JUN 2011

Although Microsoft Windows smart quotes are the usual culprits for web developers who need to display strings on devices powered by operating systems other than Windows, there are in fact a number of other Windows-only special characters that can potentially rear their heads every now and then.

Below is a handy list of string replaces (done verbosely for easier reading) that will replace these Windows special characters with accepted alternatives which can more easily be ported across to different systems:

 $str = str_replace(chr(130), ',', $str);    // baseline single quote
 $str = str_replace(chr(131), 'NLG', $str);  // florin
 $str = str_replace(chr(132), '"', $str);    // baseline double quote
 $str = str_replace(chr(133), '...', $str);  // ellipsis
 $str = str_replace(chr(134), '**', $str);   // dagger (a second footnote)
 $str = str_replace(chr(135), '***', $str);  // double dagger (a third footnote)
 $str = str_replace(chr(136), '^', $str);    // circumflex accent
 $str = str_replace(chr(137), 'o/oo', $str); // permile
 $str = str_replace(chr(138), 'Sh', $str);   // S Hacek
 $str = str_replace(chr(139), '<', $str);    // left single guillemet
 $str = str_replace(chr(140), 'OE', $str);   // OE ligature
 $str = str_replace(chr(145), "'", $str);    // left single quote
 $str = str_replace(chr(146), "'", $str);    // right single quote
 $str = str_replace(chr(147), '"', $str);    // left double quote
 $str = str_replace(chr(148), '"', $str);    // right double quote
 $str = str_replace(chr(149), '-', $str);    // bullet
 $str = str_replace(chr(150), '-', $str);    // endash
 $str = str_replace(chr(151), '--', $str);   // emdash
 $str = str_replace(chr(152), '~', $str);    // tilde accent
 $str = str_replace(chr(153), '(TM)', $str); // trademark ligature
 $str = str_replace(chr(154), 'sh', $str);   // s Hacek
 $str = str_replace(chr(155), '>', $str);    // right single guillemet
 $str = str_replace(chr(156), 'oe', $str);   // oe ligature
 $str = str_replace(chr(159), 'Y', $str);    // Y Dieresis

Should be useful.