Bodu.Text.Encoding 1.3.0

dotnet add package Bodu.Text.Encoding --version 1.3.0
                    
NuGet\Install-Package Bodu.Text.Encoding -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bodu.Text.Encoding" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bodu.Text.Encoding" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Bodu.Text.Encoding" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bodu.Text.Encoding --version 1.3.0
                    
#r "nuget: Bodu.Text.Encoding, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bodu.Text.Encoding@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bodu.Text.Encoding&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Bodu.Text.Encoding&version=1.3.0
                    
Install as a Cake Tool

Bodu.Text.Encoding

API stability - Stable. The public API surface is committed: breaking changes are reserved for a major-version bump per SemVer, except a deliberate break that is recorded in the release notes and in the package's CompatibilitySuppressions.xml. See versioning and support.

Binary-to-text encodings for .NET 8 and .NET 10 - Base16, Base32, Base45, Base58, Base62, Base64, Base85, and Bech32, plus Base58Check, Base64Url, percent-encoding, and quoted-printable - with a uniform static API, variant selection, encode-time formatting options, and decode-time leniency styles. The five core encodings (Base16, Base32, Base58, Base64, Base85) expose span, string, UTF-8, and IBufferWriter<> surfaces with Try* and length-calculation overloads for allocation-free use.

Installation

dotnet add package Bodu.Text.Encoding

Targets net8.0 and net10.0. All types live in the Bodu.Text.Encoding namespace.

Encodings and variants

Encoding Variants (*Variant enum) Notes
Base16 Lower, Upper Hexadecimal
Base32 Standard (RFC 4648), HexExtended (RFC 4648 §7), Crockford, ZBase32
Base45 - RFC 9285 (QR payloads)
Base58 BitcoinFlickr (the Bitcoin alphabet), Ripple, Flickr Base58Check adds a checksum for address-style payloads
Base62 -
Base64 Standard (RFC 4648), UrlSafe (§5), Mime (RFC 2045) Base64Url is Base64 with UrlSafe bound; it accepts input with or without padding
Base85 Ascii85 (Adobe/PDF), Z85 (ZeroMQ), GitCompact (Git binary patches)
Bech32 Bech32Encoding checksum variants

API shape

Each encoding is a static class with a consistent surface:

using Bodu.Text.Encoding;

string hex = Base16.Encode(data, Base16Variant.Upper);
byte[] back = Base16.Decode(hex);

// Variant + formatting options
string b64 = Base64.Encode(data, Base64Variant.UrlSafe, BaseFormattingOptions.OmitPadding);

// Allocation-free
Span<char> dest = stackalloc char[Base32.GetEncodedLength(data.Length)];
Base32.TryEncode(data, dest, out int written, Base32Variant.Crockford);
  • Encode / Decode, TryEncode / TryDecode, GetEncodedLength / GetDecodedLength.
  • UTF-8 surfaces (EncodeToUtf8, DecodeFromUtf8) and IBufferWriter<byte> / IBufferWriter<char> overloads, as static members of the five core encodings.
  • BinaryEncodings provides variant-aware IBinaryEncoding instances for polymorphic selection.

BaseFormattingOptions (encode) toggles casing, line breaks, prefixes, spacing, and padding omission; BaseFormatStyles (decode) controls leniency - prefix tolerance, whitespace skipping, missing padding, and canonical-form enforcement.

Runnable samples

The repository ships offline, dotnet run-able sample projects for this package - the catalogue and variant tour, the formatting/parse-style knobs, checksummed Base58Check and Bech32 corruption detection, the BinaryEncodings registry, and a custom Base36 codec proven by the shipped contract-test base - under samples/Text.Encoding/.

Building and testing

To build this package from source and run its tests, see CONTRIBUTING.md. The published vectors and corpora the tests hold it to are listed under conformance and test vectors.

License

MIT. © Bodu Pty. Ltd.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 139 10/16/2026
1.0.0 3,280 9/24/2026
0.7.0 572 9/24/2026
0.6.0 113 9/24/2026
0.5.0 127 9/23/2026