Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ private static string RemoveComment(string line)
/// </summary>
private static Stream GetIdnaTestTxt()
{
// The doc https://unicode-org.github.io/icu/download/#previous-releases list the ICU version for each version of Unicode.
// some exception for Windows which released ICU 72.1.0.4 which using Unicode 15.1.

string fileName = null;
if (PlatformDetection.ICUVersion >= new Version(76, 0))
fileName = "IdnaTest_16.txt";
else if (PlatformDetection.ICUVersion >= new Version(72, 0))
else if (PlatformDetection.ICUVersion >= new Version(72, 1, 0, 4))
fileName = "IdnaTest_15_1.txt";
else if (PlatformDetection.ICUVersion >= new Version(72, 0))
fileName = "IdnaTest_15_0.txt";
else if (PlatformDetection.ICUVersion >= new Version(66, 0) || PlatformDetection.IsHybridGlobalizationOnApplePlatform)
fileName = "IdnaTest_13.txt";
else if (PlatformDetection.IsWindows7)
Expand Down Expand Up @@ -67,8 +72,10 @@ private static IConformanceIdnaTest GetConformanceIdnaTest(string line, int line
{
if (PlatformDetection.ICUVersion >= new Version(76, 0))
return new Unicode_16_0_IdnaTest(line, lineCount);
else if (PlatformDetection.ICUVersion >= new Version(72, 0))
else if (PlatformDetection.ICUVersion >= new Version(72, 1, 0, 4))
return new Unicode_15_1_IdnaTest(line, lineCount);
else if (PlatformDetection.ICUVersion >= new Version(72, 0))
return new Unicode_15_0_IdnaTest(line, lineCount);
else if (PlatformDetection.ICUVersion >= new Version(66, 0) || PlatformDetection.IsHybridGlobalizationOnApplePlatform)
return new Unicode_13_0_IdnaTest(line, lineCount);
else if (PlatformDetection.IsWindows7)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Unicode IDNA Mapping and Test Data
# Date: 2022-09-02
# © 2022 Unicode®, Inc.
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
# For terms of use, see https://www.unicode.org/terms_of_use.html

This directory contains final data files for version 15.0.0 of
UTS #46, Unicode IDNA Compatibility Processing.

https://www.unicode.org/reports/tr46/
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text;
using Xunit;

namespace System.Globalization.Tests
{
/// <summary>
/// Class to read data obtained from http://www.unicode.org/Public/idna. For more information read the information
/// contained in Data\Unicode_15_0\IdnaTest_15_0.txt
///
/// The structure of the data set is a semicolon delimited list with the following columns:
///
/// Column 1: source - The source string to be tested
/// Column 2: toUnicode - The result of applying toUnicode to the source,
/// with Transitional_Processing=false.
/// A blank value means the same as the source value.
/// Column 3: toUnicodeStatus - A set of status codes, each corresponding to a particular test.
/// A blank value means [] (no errors).
/// Column 4: toAsciiN - The result of applying toASCII to the source,
/// with Transitional_Processing=false.
/// A blank value means the same as the toUnicode value.
/// Column 5: toAsciiNStatus - A set of status codes, each corresponding to a particular test.
/// A blank value means the same as the toUnicodeStatus value.
/// An explicit [] means no errors.
/// Column 6: toAsciiT - The result of applying toASCII to the source,
/// with Transitional_Processing=true.
/// A blank value means the same as the toAsciiN value.
/// Column 7: toAsciiTStatus - A set of status codes, each corresponding to a particular test.
/// A blank value means the same as the toAsciiNStatus value.
/// An explicit [] means no errors.
///
/// If the value of toUnicode or toAsciiN is the same as source, the column will be blank.
/// </summary>
public class Unicode_15_0_IdnaTest : Unicode_IdnaTest
{
public Unicode_15_0_IdnaTest(string line, int lineNumber)
{
var split = line.Split(';');

Type = PlatformDetection.IsNlsGlobalization ? IdnType.Transitional : IdnType.Nontransitional;

Source = EscapedToLiteralString(split[0], lineNumber);

UnicodeResult = new ConformanceIdnaUnicodeTestResult(EscapedToLiteralString(split[1], lineNumber), Source, EscapedToLiteralString(split[2], lineNumber), string.Empty);
ASCIIResult = new ConformanceIdnaTestResult(EscapedToLiteralString(split[3], lineNumber), UnicodeResult.Value, EscapedToLiteralString(split[4], lineNumber), UnicodeResult.StatusValue);

// NLS uses transitional IDN processing.
if (Type == IdnType.Transitional)
{
ASCIIResult = new ConformanceIdnaTestResult(EscapedToLiteralString(split[5], lineNumber), ASCIIResult.Value, EscapedToLiteralString(split[6], lineNumber), ASCIIResult.StatusValue);
}

LineNumber = lineNumber;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Globalization.Tests
{
/// <summary>
/// Class to read data obtained from http://www.unicode.org/Public/idna. For more information read the information
/// contained in Data\Unicode_15_0\IdnaTest_15.txt
/// contained in Data\Unicode_15_1\IdnaTest_15_1.txt
///
/// The structure of the data set is a semicolon delimited list with the following columns:
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
Link="IdnMapping\Data\Unicode_11_0\Unicode_11_0_IdnaTest.cs" />
<Compile Include="..\IdnMapping\Data\Unicode_13_0\Unicode_13_0_IdnaTest.cs"
Link="IdnMapping\Data\Unicode_13_0\Unicode_13_0_IdnaTest.cs" />
<Compile Include="..\IdnMapping\Data\Unicode_15_0\Unicode_15_0_IdnaTest.cs"
Link="IdnMapping\Data\Unicode_15_0\Unicode_15_0_IdnaTest.cs" />
<Compile Include="..\IdnMapping\Data\Unicode_15_1\Unicode_15_1_IdnaTest.cs"
Link="IdnMapping\Data\Unicode_15_1\Unicode_15_1_IdnaTest.cs" />
<Compile Include="..\IdnMapping\Data\Unicode_16_0\Unicode_16_0_IdnaTest.cs"
Expand Down Expand Up @@ -52,6 +54,7 @@
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_9_0\IdnaTest_9.txt" />
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_11_0\IdnaTest_11.txt" />
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_13_0\IdnaTest_13.txt" />
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_15_0\IdnaTest_15_0.txt" />
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_15_1\IdnaTest_15_1.txt" />
<EmbeddedResource Include="..\IdnMapping\Data\Unicode_16_0\IdnaTest_16.txt" />
<EmbeddedResource Include="..\Normalization\Data\win8.txt">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<Compile Include="IdnMapping\Data\Unicode_9_0\Unicode_9_0_IdnaTest.cs" />
<Compile Include="IdnMapping\Data\Unicode_11_0\Unicode_11_0_IdnaTest.cs" />
<Compile Include="IdnMapping\Data\Unicode_13_0\Unicode_13_0_IdnaTest.cs" />
<Compile Include="IdnMapping\Data\Unicode_15_0\Unicode_15_0_IdnaTest.cs" />
<Compile Include="IdnMapping\Data\Unicode_15_1\Unicode_15_1_IdnaTest.cs" />
<Compile Include="IdnMapping\Data\Unicode_16_0\Unicode_16_0_IdnaTest.cs" />
<Compile Include="IdnMapping\IdnMappingIdnaConformanceTests.cs" />
Expand All @@ -30,6 +31,7 @@
<EmbeddedResource Include="IdnMapping\Data\Unicode_9_0\IdnaTest_9.txt" />
<EmbeddedResource Include="IdnMapping\Data\Unicode_11_0\IdnaTest_11.txt" />
<EmbeddedResource Include="IdnMapping\Data\Unicode_13_0\IdnaTest_13.txt" />
<EmbeddedResource Include="IdnMapping\Data\Unicode_15_0\IdnaTest_15_0.txt" />
<EmbeddedResource Include="IdnMapping\Data\Unicode_15_1\IdnaTest_15_1.txt" />
<EmbeddedResource Include="IdnMapping\Data\Unicode_16_0\IdnaTest_16.txt" />
<EmbeddedResource Include="Normalization\Data\win8.txt">
Expand Down
Loading