Skip to content

Lack of documentation for encoding fallbacks #11555

Open
@ulrj

Description

@ulrj

Description

Hi

neither me not copilot found any documentation why the following program (in particular the GetBytes part) does what it does and if there are other character replacements. I think there should be a full table of character replacements applied somewhere documented or easily retrievable in code.

using System;
using System.Text;

namespace EncodingFun1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Encoding.Latin1.GetString(Encoding.Latin1.GetBytes("© Š š Ž ž Œ œ Ÿ €")));
            Console.ReadKey();
        }
    }
}

Copilot asked me to report this here. So I did.

Best Regards

Marc

Reproduction Steps

Encoding.Latin1.GetBytes("Š")[0]; // returns 83 and not 63. This is fine, but needs documentation.

Expected behavior

documented behavior

Actual behavior

undocumented behavior

Regression?

no.

Known Workarounds

guessing.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions