2

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?

makerofthings7
  • 6,038
  • 4
  • 39
  • 77
  • 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](http://stackoverflow.com/q/11269079/328397) and updating pre existing code to C# – makerofthings7 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

2 Answers2

3

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

DeadMG
  • 36,794
  • 8
  • 70
  • 139
0

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)
makerofthings7
  • 6,038
  • 4
  • 39
  • 77