Skip to content

Convert UTF8toUTF16 to TryUTF8toUTF16 #1024

Open
@paulirwin

Description

I also noticed when searching for IndexOutOfRangeException that UTF8toUTF16 can throw it, also. This is unusual to have to deal with, so we should change this method to TryUTF8toUTF16 so we can eliminate this exception that is clearly exclusively meant for control flow when the UTF8 format is invalid. It is caught in several places to do a fallback, and we should fix this. Note that we will most likely be converting the byte[] overload to use ReadOnlySpan<byte> and getting rid of the offset and length parameters.

Originally posted by @NightOwl888 in #1018 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions