Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

.Net: Bug: BinaryContent does not decode the %xx escapes of a non-base64 data URI

Open Beginner friendly
#14,518 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

@Laurianti is already working on this.

Since Oct 1, 2026.

  • #14519 by @Laurianti — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start at BinaryContent.GetCachedByteArrayContent and review the existing DataUriParser tests, which document that non-base64 data remains escaped there. Verify the conversion to bytes for the two reported inputs: the text becomes “A brief note” and the binary data becomes FF 00 80, with coverage for both cases.

Written by the indexing model from the issue text.

Description

.NET triage

Describe the bug
BinaryContent, and so ImageContent and AudioContent, built from a data URI without ;base64 returns the URI's data as UTF-8 text with the %xx escapes still in it. DataUriParser follows RFC 2397, where "the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range".

To Reproduce

var content = new BinaryContent("data:,A%20brief%20note");
Console.WriteLine(Encoding.UTF8.GetString(content.Data!.Value.Span)); // A%20brief%20note

Data as hex:

data:,A%20brief%20note                   -> 41 25 32 30 62 72 69 65 66 25 32 30 6E 6F 74 65 ("A%20brief%20note")
data:application/octet-stream,%FF%00%80  -> 25 46 46 25 30 30 25 38 30 ("%FF%00%80")

Expected behavior
A brief note, as in the RFC 2397 example ("The URL data:,A%20brief%20note encodes the text/plain string "A brief note""), and the three octets FF 00 80.

Platform

  • Language: C#
  • Source: NuGet Microsoft.SemanticKernel.Abstractions 1.80.1, also main at 58ad1a378
  • OS: Linux (mcr.microsoft.com/dotnet/sdk:10.0)

Additional context
BinaryContent.GetCachedByteArrayContent returns Encoding.UTF8.GetBytes(parsedDataUri.Data) for non-base64 data. DataUriParser keeps the data escaped (its tests expect A%20brief%20note), so the decoding belongs to the conversion to bytes.

Dominant language
C#
Stars
28.6k
Forks
4.8k
Avg merge
1d 15h
Merged PRs (30d)
12

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/semantic-kernel

All issues in microsoft/semantic-kernel

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.