Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I reckon that the only practical way is to manually define some kind of 'mask' for each code page; a structure that defines all of the character values that you consider valid for each of your code pages.</p> <p>Then, you could check if the page contained any character values that weren't contained in this mask. </p> <p>Building the mask would involve a fair bit of manual effort. Create a page with every character, then display it using the appropriate code page and then look to see which aren't rendered 'nicely'. It's a one-off activity for each code page, so perhaps worth the effort.</p> <p>Of course, if there was a way to parse a code page, you could generate this mask automatically... Hmm... Back in a bit.</p> <p>Try this code fragment. It tests the characters 32-255 against each known code page.</p> <pre><code> StringBuilder source = new StringBuilder(); for (int ix = 0; ix &lt; 224; ix++) { source.Append((char)(ix + 32)); } EncodingInfo[] encs = Encoding.GetEncodings(); foreach (var encInfo in encs) { System.Console.WriteLine(encInfo.DisplayName); Encoding enc = Encoding.GetEncoding(encInfo.CodePage); var result = enc.GetBytes(source.ToString().ToCharArray()); for (int ix = 0; ix &lt; 224; ix++) { if (result[ix] == 63 &amp;&amp; source[ix] != 63) { // Code page translated character to '?' System.Console.Write("{0:d}", source[ix]); } } System.Console.WriteLine(); } </code></pre> <p>I was looking around in the debugger and noticed that '?' is used as a fall-back character if the source character is not included in the code page. By checking for '?' (and ensuring that it wasn't '?' to start with), the code assumes that the code page couldn't handle it.</p> <p>DBCS code pages may need a bit more attention, I've not looked. But try this as a starting point.</p> <p>I'd use code like this to build an initial 'mask', as I described earlier, and then manually adjust that mask based on what looked good and what didn't.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload