Included a ReadMe, a License file, and a code example.
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Unicode;
|
||||||
|
|
||||||
|
namespace Example
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
private static void Main()
|
||||||
|
{
|
||||||
|
Console.OutputEncoding = Encoding.Unicode;
|
||||||
|
PrintCodePointInfo('A');
|
||||||
|
PrintCodePointInfo('∞');
|
||||||
|
PrintCodePointInfo(0x1F600);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PrintCodePointInfo(int codePoint)
|
||||||
|
{
|
||||||
|
var charInfo = UnicodeInfo.GetCharInfo(codePoint);
|
||||||
|
Console.WriteLine(UnicodeInfo.GetDisplayText(charInfo));
|
||||||
|
Console.WriteLine("U+" + codePoint.ToString("X4"));
|
||||||
|
Console.WriteLine(charInfo.Name ?? charInfo.OldName);
|
||||||
|
Console.WriteLine(charInfo.Category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Fabien Barbier
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
.NET Unicode Information Library
|
||||||
|
========================
|
||||||
|
|
||||||
|
Summary
|
||||||
|
-------
|
||||||
|
This projects provides access to some of the data contained in the Unicode Character Database by the means of a portable .NET assembly.
|
||||||
|
Included, is a small WPF application allowing to inspect the Unicode code points composing a specified text.
|
||||||
|
|
||||||
|
Compiling and using the project
|
||||||
|
-------------------------------
|
||||||
|
### Using the UnicodeInformation library
|
||||||
|
Using the library is as easy as including it in your project. You will find all the good stuff in the System.Unicode namespace.
|
||||||
|
|
||||||
|
Let's see a simple example:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Unicode;
|
||||||
|
|
||||||
|
namespace Example
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
private static void Main()
|
||||||
|
{
|
||||||
|
Console.OutputEncoding = Encoding.Unicode;
|
||||||
|
PrintCodePointInfo('A');
|
||||||
|
PrintCodePointInfo('∞');
|
||||||
|
PrintCodePointInfo(0x1F600);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PrintCodePointInfo(int codePoint)
|
||||||
|
{
|
||||||
|
var charInfo = UnicodeInfo.GetCharInfo(codePoint);
|
||||||
|
Console.WriteLine(UnicodeInfo.GetDisplayText(charInfo));
|
||||||
|
Console.WriteLine("U+" + codePoint.ToString("X4"));
|
||||||
|
Console.WriteLine(charInfo.Name ?? charInfo.OldName);
|
||||||
|
Console.WriteLine(charInfo.Category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
This example shows a few usages of the library. It gets information on a specific code point, queries the library for the text to display for the specific character (usually the character itself), and displays the character's name and category.
|
||||||
|
|
||||||
|
### Details
|
||||||
|
In its current state, the project is written in C# 6, compilable by [Roslyn](http://roslyn.codeplex.com/), and targets the .NET 4.5 framework.
|
||||||
|
The core of the project, UnicodeInformation.dll, is a portable class library usable for either regular .NET or Windows 8 applications.
|
||||||
|
This library includes a subset of the official [Unicode Character Database](http://www.unicode.org/Public/UCD/latest/) (Version 7.0 at the time of writing) stored in a custom file format.
|
||||||
|
|
||||||
|
### Included Properties
|
||||||
|
#### From UCD
|
||||||
|
* Name
|
||||||
|
* General_Category
|
||||||
|
* Canonical_Combining_Class
|
||||||
|
* Bidi_Class
|
||||||
|
* Decomposition_Type
|
||||||
|
* Decomposition_Mapping
|
||||||
|
* Numeric_Type (*)
|
||||||
|
* Numeric_Value
|
||||||
|
* Bidi_Mirrored
|
||||||
|
* Unicode_1_Name
|
||||||
|
* Simple_Uppercase_Maping
|
||||||
|
* Simple_Lowercase_Mapping
|
||||||
|
* Simple_Titlecase_Mapping
|
||||||
|
* Block
|
||||||
|
* ASCII_Hex_Digit
|
||||||
|
* Bidi_Control
|
||||||
|
* Dash
|
||||||
|
* Deprecated
|
||||||
|
* Diacritic
|
||||||
|
* Extender
|
||||||
|
* Hex_Digit
|
||||||
|
* Hyphen
|
||||||
|
* Ideographic
|
||||||
|
* IDS_Binary_Operator
|
||||||
|
* IDS_Trinary_Operator
|
||||||
|
* Join_Control
|
||||||
|
* Logical_Order_Exception
|
||||||
|
* Noncharacter_Code_Point
|
||||||
|
* Other_Alphabetic
|
||||||
|
* Other_Default_Ignorable_Code_Point
|
||||||
|
* Other_Grapheme_Extend
|
||||||
|
* Other_ID_Continue
|
||||||
|
* Other_ID_Start
|
||||||
|
* Other_Lowercase
|
||||||
|
* Other_Math
|
||||||
|
* Other_Uppercase
|
||||||
|
* Pattern_Syntax
|
||||||
|
* Pattern_White_Space
|
||||||
|
* Quotation_Mark
|
||||||
|
* Radical
|
||||||
|
* Soft_Dotted
|
||||||
|
* STerm
|
||||||
|
* Terminal_Punctuation
|
||||||
|
* Unified_Ideograph
|
||||||
|
* Variation_Selector
|
||||||
|
* White_Space
|
||||||
|
* Lowercase
|
||||||
|
* Uppercase
|
||||||
|
* Cased
|
||||||
|
* Case_Ignorable
|
||||||
|
* Changes_When_Lowercased
|
||||||
|
* Changes_When_Uppercased
|
||||||
|
* Changes_When_Titlecased
|
||||||
|
* Changes_When_Casefolded
|
||||||
|
* Changes_When_Casemapped
|
||||||
|
* Alphabetic
|
||||||
|
* Default_Ignorable_Code_Point
|
||||||
|
* Grapheme_Base
|
||||||
|
* Grapheme_Extend
|
||||||
|
* Grapheme_Link
|
||||||
|
* Math
|
||||||
|
* ID_Start
|
||||||
|
* ID_Continue
|
||||||
|
* XID_Start
|
||||||
|
* XID_Continue
|
||||||
|
|
||||||
|
NB: The UCD property ISO_Comment will never be included since this one is empty in all new Unicode versions.
|
||||||
|
|
||||||
|
#### From Unihan
|
||||||
|
* kAccountingNumeric
|
||||||
|
* kOtherNumeric
|
||||||
|
* kPrimaryNumeric
|
||||||
|
* kDefinition
|
||||||
|
* kMandarin
|
||||||
|
* kCantonese
|
||||||
|
* kJapaneseKun
|
||||||
|
* kJapaneseOn
|
||||||
|
* kKorean
|
||||||
|
* kHangul
|
||||||
|
* kVietnamese
|
||||||
|
* kSimplifiedVariant
|
||||||
|
* kTraditionalVariant
|
||||||
|
|
||||||
|
### Regenerating the data
|
||||||
|
The project UnicodeInformation.Builder takes cares of generating a file named ucd.dat. This file contains Unicode data compressed by .NET's deflate algorithm, and should be included in UnicodeInformation.dll at compilation.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.22129.1
|
VisualStudioVersion = 14.0.22310.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeCharacterInspector", "UnicodeCharacterInspector\UnicodeCharacterInspector.csproj", "{04E97F21-EF04-441F-83CF-2E71F3AAB089}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeCharacterInspector", "UnicodeCharacterInspector\UnicodeCharacterInspector.csproj", "{04E97F21-EF04-441F-83CF-2E71F3AAB089}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -13,6 +13,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeInformation.Builder"
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{73097DF3-04B7-4C5F-B4EA-0EB800E40702}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{73097DF3-04B7-4C5F-B4EA-0EB800E40702}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Example.cs = Example.cs
|
||||||
|
LICENSE.txt = LICENSE.txt
|
||||||
|
README.md = README.md
|
||||||
System.Unicode.snk = System.Unicode.snk
|
System.Unicode.snk = System.Unicode.snk
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
Reference in New Issue
Block a user