Itaiji.NetFramework 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Itaiji.NetFramework --version 0.1.1
                    
NuGet\Install-Package Itaiji.NetFramework -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.NetFramework" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Itaiji.NetFramework" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Itaiji.NetFramework" />
                    
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.NetFramework --version 0.1.1
                    
#r "nuget: Itaiji.NetFramework, 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.NetFramework@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.NetFramework&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Itaiji.NetFramework&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 Framework net35 is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.8

    • 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 103 2/22/2026
0.2.0 105 2/14/2026
0.1.1 239 12/7/2025
0.1.0 241 12/7/2025