I'm fixing code that is using ASCIIEncoding in some places and UTF-8 encoding in other functions.

Since we aren't using the UTF-8 features, all of our unit tests passed, but I want to create a heightened awareness of encodings that produce similar results and may not be fully tested.

I don't want to limit this to just UTF-8 vs ASCII, since I think issue with code that handles ASN.1 fields and other code working with Base64.

So, what are the commonly confused encodings that may result in identical test data?

  • is it an XML or varchar in DB table? what type of document and where you use encoding? – Yusubov Jun 30 '12 at 18:45
  • @ElYusubov I have many questions that relate to converting this ASN.1 data and updating pre existing code to C# – halfbit Jun 30 '12 at 18:50
  • you may need to tag questions in more helpful way, i just tried to clarify. Thx for link though. – Yusubov Jun 30 '12 at 18:54

Windows Codepages and Extended ASCII support are virtually guaranteed to throw you a curveball.


For MIME the following headers may produce similar results:

  • Content-type: text/plain; charset=us-ascii (Plain text)
  • Content-type: text/plain; charset=UTF-8 (a superset of ASCII)
  • Content-type: text/plain; charset="ISO-8859-2" (another superset of ASCII)
  • Content-type: text/enriched; charset="windows-1252" (if there are no enriched codes)
  • Is latin1 synonymous with ISO-8859-2, or might it be another "superset of ASCII" that could be useful? – detly Jul 3 '12 at 3:06
  • Latin1 is ISO-8859-1. – Joachim Sauer Jul 3 '12 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.