Make the name uppercase for code point ranges, and cleared the name property of control codes, as per the spec.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
TextOptions.TextFormattingMode="Display"
|
||||
Title="Unicode character inspector"
|
||||
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
|
||||
Height="350" Width="525">
|
||||
Height="450" Width="525">
|
||||
<Window.DataContext>
|
||||
<local:CharacterInspectorViewModel />
|
||||
</Window.DataContext>
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace System.Unicode.Builder
|
||||
|
||||
using (var ucdSource = GetUcdSource(null, null, null))
|
||||
{
|
||||
data = UnicodeDataManager.BuildDataAsync(ucdSource).Result;
|
||||
data = UnicodeDataProcessor.BuildDataAsync(ucdSource).Result;
|
||||
}
|
||||
|
||||
using (var stream = new DeflateStream(File.Create("ucd.dat"), CompressionLevel.Optimal, false))
|
||||
|
||||
+8
-5
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace System.Unicode.Builder
|
||||
{
|
||||
public class UnicodeDataManager
|
||||
public class UnicodeDataProcessor
|
||||
{
|
||||
public const string UnicodeDataFileName = "UnicodeData.txt";
|
||||
public const string PropListFileName = "PropList.txt";
|
||||
@@ -55,15 +55,18 @@ namespace System.Unicode.Builder
|
||||
|
||||
codePoint = new UnicodeCharacterRange(rangeStartCodePoint, codePoint.LastCodePoint);
|
||||
|
||||
name = name.Substring(1, name.Length - 8);
|
||||
name = name.Substring(1, name.Length - 8).ToUpperInvariant(); // Upper-case the name in order to respect unicode naming scheme. (Spec says all names are uppercase ASCII)
|
||||
|
||||
rangeStartCodePoint = -1;
|
||||
}
|
||||
else if (name == "<control>") // Ignore the name of the property for these code points, as it should really be empty by the spec.
|
||||
{
|
||||
// For control characters, we can derive a character label in of the form <control-NNNN>, which is not the character name.
|
||||
name = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = name.Substring(1, name.Length - 2);
|
||||
|
||||
if (codePoint.IsSingleCodePoint) name = name + "-" + codePoint.ToString();
|
||||
throw new InvalidDataException("Unexpected code point name tag: " + name + ".");
|
||||
}
|
||||
}
|
||||
else if (rangeStartCodePoint >= 0)
|
||||
@@ -62,7 +62,7 @@
|
||||
<Compile Include="UnicodeCharacterDataBuilder.cs" />
|
||||
<Compile Include="UnicodeDataBuilder.cs" />
|
||||
<Compile Include="UnicodeDataFileReader.cs" />
|
||||
<Compile Include="UnicodeDataManager.cs" />
|
||||
<Compile Include="UnicodeDataProcessor.cs" />
|
||||
<Compile Include="ZipUcdSource.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace System.Unicode.Tests
|
||||
{
|
||||
var source = new FileUcdSource(UcdDirectoryName);
|
||||
|
||||
var data = (await UnicodeDataManager.BuildDataAsync(source)).ToUnicodeData();
|
||||
var data = (await UnicodeDataProcessor.BuildDataAsync(source)).ToUnicodeData();
|
||||
|
||||
Assert.AreEqual((int)'\t', data.Get('\t').CodePoint);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace System.Unicode.Tests
|
||||
{
|
||||
var source = new FileUcdSource(UcdDirectoryName);
|
||||
|
||||
var data = await UnicodeDataManager.BuildDataAsync(source);
|
||||
var data = await UnicodeDataProcessor.BuildDataAsync(source);
|
||||
|
||||
using (var stream = new DeflateStream(File.Create("ucd.dat"), CompressionLevel.Optimal, false))
|
||||
{
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user