UTF.Unknown 2.7.0

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

CI/CD NuGet Pre Release

<h1><img src="https://raw.githubusercontent.com/CharsetDetector/UTF-unknown/main/logo.png" width="40" height="40" /> UTF Unknown </h1>

Detect character set for files, streams and other bytes.

Detection of character sets with a simple and redesigned interface.

This package is based on Ude and since version 2 also on uchardet, which are ports of the Mozilla Universal Charset Detector.

The interface and other classes have been redesigned so it's easier to use and has a better object oriented design (OOD). Unit tests and CI have been added.

Features:

  • New API
  • Moved to .NET Standard
  • Added more unit tests
  • Builds on CI (GitHub Actions)
  • Strong named
  • Documentation added
  • Multiple bugs from Ude fixed

Supported Platforms

  • .NET 8
  • .NET Standard 2.0

Note: .NET 6 support was removed in version 2.7.0.

Remarks: You can still register your EncodingProvider so that the Encoding.GetEncoding(...) method first tries to find in it.

Usage

Use the static detectX methods from CharsetDetector.

Synchronous Methods

// Detect from File 
DetectionResult result = CharsetDetector.DetectFromFile("path/to/file.txt"); // or pass FileInfo

// Detect from Stream
result = CharsetDetector.DetectFromStream(stream);

// Detect from bytes
results = CharsetDetector.DetectFromBytes(byteArray);

// Detect from a ReadOnlySpan<byte> (also accepts Span<byte> implicitly)
results = CharsetDetector.DetectFromBytes(readOnlySpanOfBytes);

// Get the best Detection
DetectionDetail resultDetected = results.Detected;

// Get the alias of the found encoding
string encodingName = resultDetected.EncodingName;

// Get the System.Text.Encoding of the found encoding (can be null if not available)
Encoding encoding = resultDetected.Encoding;

// Get the confidence of the found encoding (between 0 and 1)
float confidence = resultDetected.Confidence;

// Get all the details of the result
IList<DetectionDetail> allDetails = result.Details;

Asynchronous Methods

// Detect from File asynchronously
DetectionResult result = await CharsetDetector.DetectFromFileAsync("path/to/file.txt", cancellationToken); // or pass FileInfo

// Detect from Stream asynchronously
result = await CharsetDetector.DetectFromStreamAsync(stream, cancellationToken);

Docs

The article "A composite approach to language/encoding detection" describes the charsets detection algorithms implemented by the library.

The following charsets are supported

Encodings with BOM: utf-7, utf-8, utf-16be/utf-16le, utf-32be/utf-32le, X-ISO-10646-UCS-4-34121/X-ISO-10646-UCS-4-21431, gb18030.

Encodings without BOM are presented in the table, separated by languages:

Language Encodings
International (Unicode) utf-8
Arabic iso-8859-6, windows-1256
Bulgarian iso-8859-5, windows-1251
Chinese iso-2022-cn, big5, euc-tw, gb18030, hz-gb-2312
Croatian iso-8859-2, iso-8859-13, iso-8859-16, windows-1250, ibm852, x-mac-ce
Czech windows-1250, iso-8859-2, ibm852, x-mac-ce
Danish iso-8859-1, iso-8859-15, windows-1252
English ascii
Esperanto iso-8859-3
Estonian iso-8859-4, iso-8859-13, iso-8859-13, windows-1252, windows-1257
Finnish iso-8859-1, iso-8859-4, iso-8859-9, iso-8859-13, iso-8859-15, windows-1252
French iso-8859-1, iso-8859-15, windows-1252
German iso-8859-1, windows-1252, CP 850/IBM 00850
Greek iso-8859-7, windows-1253
Hebrew iso-8859-8, windows-1255
Hungarian iso-8859-2, windows-1250
Irish Gaelic iso-8859-1, iso-8859-9, iso-8859-15, windows-1252
Italian iso-8859-1, iso-8859-3, iso-8859-9, iso-8859-15, windows-1252
Japanese iso-2022-jp, shift-jis, euc-jp
Korean iso-2022-kr, euc-kr/uhc, cp949
Lithuanian iso-8859-4, iso-8859-10, iso-8859-13
Latvian iso-8859-4, iso-8859-10, iso-8859-13
Maltese iso-8859-3
Polish iso-8859-2, iso-8859-13, iso-8859-16, windows-1250, ibm852, x-mac-ce
Portuguese iso-8859-1, iso-8859-9, iso-8859-15, windows-1252
Romanian iso-8859-2, iso-8859-16, windows-1250, ibm852
Russian iso-8859-5, koi8-r, windows-1251, x-mac-cyrillic, ibm855, ibm866
Slovak windows-1250, iso-8859-2, ibm852, x-mac-ce
Slovene iso-8859-2, iso-8859-16, windows-1250, ibm852, x-mac-ce
Spanish iso-8859-1, iso-8859-15, windows-1252
Swedish iso-8859-1, iso-8859-4, iso-8859-9, iso-8859-15, windows-1252
Thai tis-620, iso-8859-11
Turkish iso-8859-3, iso-8859-9
Vietnamese viscii, windows-1258
Others windows-1252

</details>

Remarks: For some encodings no alias is available: cp949, iso-2022-cn, euc-tw, iso-8859-10, iso-8859-16, viscii, X-ISO-10646-UCS-4-34121/X-ISO-10646-UCS-4-21431. Some of them have been offered a suitable replacement for the return result by DetectionDetail.Encoding:

  • cp949: use ks_c_5601-1987
  • iso-2022-cn: use x-cp50227

License

The library is subject to the Mozilla Public License Version 1.1 (the "License"). Alternatively, it may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL").

Test data has been extracted from Wikipedia and The Project Gutenberg books and is subject to their licenses.

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 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 is compatible.  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 (26)

Showing the top 5 NuGet packages that depend on UTF.Unknown:

Package Downloads
MsgReader

Read Outlook MSG and EML files without using Outlook. The MSGReader supports MSG E-Mail (also signed), Contact, Appointment, Task, Sticky notes and Contact files. The EML reader supports MIME 1.0 encoded files.

StrongGrid

StrongGrid is a strongly typed .NET client for SendGrid's v3 API.

libse

Subtitle Edit's subtitle library - read/write 300+ subtitle formats (SubRip, ASSA, WebVTT, EBU STL, Blu-ray sup, and many more), fix common errors, auto-break lines, convert formats, and more.

ChromeHtmlToPdf

ChromiumHtmlToPdf is a 100% managed C# library that can be used to convert HTML to PDF or PNG format with the use of Google Chrome or Microsoft Edge

Wanadi.Common

Funcionalidades comuns utilizadas em projetos e nos Pacotes Wanadi.

GitHub repositories (25)

Showing the top 20 popular GitHub repositories that depend on UTF.Unknown:

Repository Stars
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
files-community/Files
A modern file manager that helps users organize their files and folders.
QL-Win/QuickLook
Bring macOS “Quick Look” feature to Windows
SubtitleEdit/subtitleedit
the subtitle editor :)
studyzy/imewlconverter
”深蓝词库转换“ 一款开源免费的输入法词库转换程序
0x7c13/Notepads
A modern, lightweight text editor with a minimalist design.
tModLoader/tModLoader
A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations
openutau/OpenUtau
Open singing synthesis platform / Open source UTAU successor
umlx5h/LLPlayer
The media player for language learning, with dual subtitles, AI-generated subtitles, real-time translation, and more!
dnGrep/dnGrep
Graphical GREP tool for Windows
RandomEngy/VidCoder
A Blu-ray, DVD and video file transcoder for Windows.
zhuxb711/RX-Explorer
一款优雅的UWP文件管理器 | An elegant UWP Explorer
Sicos1977/MSGReader
C# Outlook MSG file reader without the need for Outlook
bcssov/IronyModManager
Mod Manager for Paradox Games. Official Discord: https://discord.gg/t9JmY8KFrV
Sicos1977/ChromiumHtmlToPdf
Convert HTML to PDF with a Chromium based browser
pebakery/pebakery
PEBakery is a script engine that specializes in customizing the Windows Preinstalled Environment (WinPE/WinRE).
vocoder712/OpenUtauMobile
OpenUtau Mobile 是一个面向移动端的开源免费歌声合成软件; OpenUtau Mobile is a free and open-source singing voice synthesis software for mobile devices.
Serg-Norseman/GEDKeeper
GEDKeeper - program for work with personal genealogical database
Jericho/StrongGrid
Strongly typed library for the entire SendGrid v3 API, including webhooks
landv/LuYao.Toolkit
LuYao.Toolkit 路遥工具箱
Version Downloads Last Updated
2.7.0 0 8/21/2026
2.6.0 2,757,694 8/6/2025
2.5.1 5,576,194 6/27/2022
2.5.0 253,687 10/26/2021
2.4.0 115,048 8/6/2021
2.3.0 550,012 12/27/2019
2.2.0 15,969 10/24/2019
2.1.0 20,444 8/24/2019
2.0.0 59,303 6/29/2019
1.0.0 7,692 2/15/2019