Itaiji 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Itaiji --version 0.1.1
                    
NuGet\Install-Package Itaiji -Version 0.1.1
                    
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="Itaiji" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Itaiji" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Itaiji" />
                    
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 Itaiji --version 0.1.1
                    
#r "nuget: Itaiji, 0.1.1"
                    
#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 Itaiji@0.1.1
                    
#: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=Itaiji&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Itaiji&version=0.1.1
                    
Install as a Cake Tool

Itaiji

本ライブラリはバージョン0.xです。予告なく破壊的変更が加えられる可能性があります。

概要

Itaijiは、.NETでUnicodeの異体字(Ideographic Variation Sequence)を便利に扱うためのライブラリです。

.Net 5+, .Net Framework 3.5/4.0/4.5/4.6/4.7/4.8 に対応しています。

パッケージ

  • Itaiji: .NET 5.0+ 向けのライブラリ
  • Itaiji.NetFramework: .NET Framework 3.5+ 向けのライブラリ

主な機能

  • 文字列から異体字セレクタの削除
  • 異体字セレクタを考慮した文字列の比較・検索
  • 異体字セレクタやサロゲートペアを考慮した文字の列挙

IVSとは

IVS(Ideographic Variation Sequence)は、同じ漢字の異なる形状を表現するためのUnicodeの仕組みです。

有名な話ですが、渡辺さんの「ナベ」の漢字には、バリエーションが数十種類あると言われています。 それらすべてにunicodeのコードポイントが割り当てられているわけではなく、 基本となる漢字に対して異体字セレクタを組み合わせることで、特定の形状を表現しています。

なお、異体字セレクタにはIVSのほかに、SVS(Standardized Variation Sequence)もありますが、 Itaijiは現状、IVSのみを対象としています。

サロゲートペアについて

.NETの文字列はUTF-16で扱われます。 unicodeのコードポイントがU+FFFFを超える場合、 1文字が2つの16ビットコードユニット(サロゲートペア)で表現されます。 IVSそのものもサロゲートペアで表現されます。

サロゲートペアで表される漢字の有名な例として、𩸽(ほっけ)や𠮷(つちよし)があります。

そのため、文字列を単純にcharの配列として扱うと、サロゲートペアが分割されてしまい、 正しい文字列操作ができなくなることがあります。

Itaijiは、System.Text.Runeを活用して、サロゲートペアを正しく扱います。 Runeを実装しない.NET Framework向けには、互換構造体を提供しています。

使用例

using Itaiji;

Console.OutputEncoding = System.Text.Encoding.UTF8;

var name = "渡辺󠄀";

//異体字を除去する
var normalized = ItaijiUtility.RemoveIvs(name);

// 異体字を考慮して比較する
var isEqual = ItaijiUtility.Equals("渡辺󠄀", "渡辺");

// 異体字を考慮して部分文字列を検索する
var (index, length) = ItaijiUtility.IndexOf("渡辺󠄀さん", "辺");

// 異体字やサロゲートペアを考慮して文字を列挙する
foreach (var ch in ItaijiUtility.EnumerateKanji("渡辺󠄀さん"))
{
	Console.WriteLine(ch);
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 was computed.  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.
  • net5.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.

Version Downloads Last Updated
0.3.0 97 2/22/2026
0.2.0 91 2/14/2026
0.1.1 236 12/7/2025
0.1.0 241 12/7/2025