KamenickyEncoding 1.0.9

dotnet add package KamenickyEncoding --version 1.0.9
                    
NuGet\Install-Package KamenickyEncoding -Version 1.0.9
                    
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="KamenickyEncoding" Version="1.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KamenickyEncoding" Version="1.0.9" />
                    
Directory.Packages.props
<PackageReference Include="KamenickyEncoding" />
                    
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 KamenickyEncoding --version 1.0.9
                    
#r "nuget: KamenickyEncoding, 1.0.9"
                    
#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 KamenickyEncoding@1.0.9
                    
#: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=KamenickyEncoding&version=1.0.9
                    
Install as a Cake Addin
#tool nuget:?package=KamenickyEncoding&version=1.0.9
                    
Install as a Cake Tool

Kamenicky Encoding

Kamenicky Encoding is a .NET library providing an implementation of the Keybcs2 (Kamenický) Czech code page. It enables conversion between Czech characters and bytes in legacy computer systems and ensures compatibility with older text files and applications.

The library is fast, as it uses precomputed character ↔ byte mappings instead of complex algorithms or runtime lookups.

History

Keybcs2 (Kamenický) originated in the 1980s–1990s for Czech and Slovak environments, where standard ASCII did not support diacritics. It was commonly used in older text editors, accounting software, and database applications.

Kamenicky Encoding provides a modern .NET implementation of this encoding, including full support for Czech characters and special symbols.

The character mapping was inspired by the Free Pascal file cp895.txt (FPC).

Usage Without Provider Registration

The simplest way to use the library is directly via a Keybcs2Encoding instance, without registering the provider:

var encoding = new Keybcs2Encoding();

string original = "Příliš žluťoučký kůň";
byte[] data = encoding.GetBytes(original);
string restored = encoding.GetString(data);

Console.WriteLine(restored); // Příliš žluťoučký kůň

This approach is ideal for isolated use, e.g., reading or writing individual files.

Optional Provider Registration

To use Keybcs2 via the standard Encoding.GetEncoding, you can register the provider:

Keybcs2EncodingProvider.Register();
var encoding = Encoding.GetEncoding("keybcs2"); // or "kamenicky", "kamenicky895"

After registration, you can use any of these names:

  • "keybcs2" – primary name
  • "kamenicky" – alias
  • "kamenicky895" – alias
string original = "Příliš žluťoučký kůň";
byte[] data = encoding.GetBytes(original);
string restored = encoding.GetString(data);

Console.WriteLine(restored); // Příliš žluťoučký kůň

Note About the CP895 Alias

This code page is sometimes referred to as CP895 or code page 895 in DOS-era applications. However, this is not an officially registered code page number — for example, IBM uses CP895 for a completely different (Japanese) set, and IANA does not recognize CP895 for Kamenický encoding. Using “CP895” may therefore be ambiguous or conflicting in some environments. (source)

Features

  • Conversion of characters to Keybcs2 bytes and back
  • Optional provider registration for global use via Encoding.GetEncoding
  • Compatible with .NET Standard and .NET Core
  • Full support for Czech characters and certain special symbols
  • Unsupported characters are replaced with ?
  • Very fast due to precomputed character ↔ byte mapping

Implementation

  • Keybcs2EncodingProvider – provides a Keybcs2Encoding instance through the standard .NET EncodingProvider mechanism
  • Keybcs2Encoding – implements all necessary Encoding methods for Keybcs2
  • CharMapping – internal static class mapping each byte to the corresponding Unicode character and vice versa

Mapping includes:

  • ASCII characters (0–127)
  • Czech/Slovak characters (128–175)
  • Box-drawing characters (176–223)
  • Greek and mathematical symbols (224–239)
  • Miscellaneous symbols (240–255)

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0.9 97 1/21/2026
1.0.7 96 1/21/2026
1.0.6 194 9/13/2024
1.0.5 165 9/13/2024
1.0.4 605 2/22/2021
1.0.3 503 2/22/2021
1.0.2 511 2/21/2021
1.0.1 488 2/20/2021