KamenickyEncoding 1.0.9
dotnet add package KamenickyEncoding --version 1.0.9
NuGet\Install-Package KamenickyEncoding -Version 1.0.9
<PackageReference Include="KamenickyEncoding" Version="1.0.9" />
<PackageVersion Include="KamenickyEncoding" Version="1.0.9" />
<PackageReference Include="KamenickyEncoding" />
paket add KamenickyEncoding --version 1.0.9
#r "nuget: KamenickyEncoding, 1.0.9"
#:package KamenickyEncoding@1.0.9
#addin nuget:?package=KamenickyEncoding&version=1.0.9
#tool nuget:?package=KamenickyEncoding&version=1.0.9
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
Keybcs2Encodinginstance through the standard .NETEncodingProvidermechanism - Keybcs2Encoding – implements all necessary
Encodingmethods 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 | Versions 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. |
-
.NETStandard 2.0
- System.Text.Encoding.CodePages (>= 10.0.2)
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.