Welcome to MSDN Blogs Sign in | Join | Help

.Net Framework Encoding Sample

A blog post I saw recently (A .Net Unicode Puzzle) reminded me of a sample we'd written for the .Net Framework Samples.  "Fallback Encoding Application Sample" demonstrates the Encoding/Decoding and Fallback classes, using the various APIs provided.

Since our inputs were more limited than other programs might be, we stretched to use some of the methods we wouldn't have ordinarily chosen, but GetBytes/GetChars, Encoders, Decoders and Convert are all shown.

There's also an example of an Encoder best fit fallback class, which decomposes a string to normalization form NFKD, and then tries each part to see if it can be encoded.  This is similar to solving the puzzle posed by Chris Mullins with the additional aspect of limiting the output to the set of characters supported by the target encoding.

Published Monday, March 05, 2007 12:28 PM by shawnste

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker