You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
61
external/corefx/src/System.Text.Encoding.CodePages/System.Text.Encoding.CodePages.sln
vendored
Normal file
61
external/corefx/src/System.Text.Encoding.CodePages/System.Text.Encoding.CodePages.sln
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22512.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.Encoding.CodePages.Tests", "tests\System.Text.Encoding.CodePages.Tests.csproj", "{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47} = {16EE6633-F557-5C9E-9EF3-B5334B044F47}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.Encoding.CodePages", "src\System.Text.Encoding.CodePages.csproj", "{16EE6633-F557-5C9E-9EF3-B5334B044F47}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU = DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU = ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU
|
||||
DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU = DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU = ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU.ActiveCfg = netstandard-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU.Build.0 = netstandard-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU.ActiveCfg = netstandard-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU.Build.0 = netstandard-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.ActiveCfg = netstandard-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.Build.0 = netstandard-Debug|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.ActiveCfg = netstandard-Release|Any CPU
|
||||
{9574CEEC-5554-411B-B44C-6CA9EC1CEB08}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.Build.0 = netstandard-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard-Unix-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard-Unix-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard-Unix-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard-Unix-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU.ActiveCfg = netstandard-Unix-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Unixnetstandard|AnyCPU.Build.0 = netstandard-Unix-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU.ActiveCfg = netstandard-Unix-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Unixnetstandard|AnyCPU.Build.0 = netstandard-Unix-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.DebugNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
|
||||
{16EE6633-F557-5C9E-9EF3-B5334B044F47}.ReleaseNETCoreAppnetstandard-Windows_NTnetstandard|AnyCPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
9
external/corefx/src/System.Text.Encoding.CodePages/dir.props
vendored
Normal file
9
external/corefx/src/System.Text.Encoding.CodePages/dir.props
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsNETCoreAppRef>false</IsNETCoreAppRef>
|
||||
</PropertyGroup>
|
||||
</Project>
|
8
external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.builds
vendored
Normal file
8
external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.builds
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Text.Encoding.CodePages.pkgproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
19
external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj
vendored
Normal file
19
external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ref\System.Text.Encoding.CodePages.csproj">
|
||||
<SupportedFramework>net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Text.Encoding.CodePages.builds" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InboxOnTargetFramework Include="MonoAndroid10" />
|
||||
<InboxOnTargetFramework Include="MonoTouch10" />
|
||||
<InboxOnTargetFramework Include="xamarinios10" />
|
||||
<InboxOnTargetFramework Include="xamarinmac20" />
|
||||
<InboxOnTargetFramework Include="xamarintvos10" />
|
||||
<InboxOnTargetFramework Include="xamarinwatchos10" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
8
external/corefx/src/System.Text.Encoding.CodePages/ref/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Text.Encoding.CodePages/ref/Configurations.props
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
17
external/corefx/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.cs
vendored
Normal file
17
external/corefx/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.cs
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class CodePagesEncodingProvider
|
||||
{
|
||||
internal CodePagesEncodingProvider() { }
|
||||
public static System.Text.EncodingProvider Instance { get { throw null; } }
|
||||
}
|
||||
}
|
10
external/corefx/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj
vendored
Normal file
10
external/corefx/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Text.Encoding.CodePages.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
9
external/corefx/src/System.Text.Encoding.CodePages/src/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Text.Encoding.CodePages/src/Configurations.props
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp-Unix;
|
||||
netcoreapp-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
372
external/corefx/src/System.Text.Encoding.CodePages/src/Data/CodePageNameMappings.csv
vendored
Normal file
372
external/corefx/src/System.Text.Encoding.CodePages/src/Data/CodePageNameMappings.csv
vendored
Normal file
@ -0,0 +1,372 @@
|
||||
#
|
||||
# This file contains data for mapping from IANA encoding names to their corresponding code page numbers
|
||||
#
|
||||
# This can be used as input to the EncodingData tool when generating EncodingTable.Data.cs
|
||||
#
|
||||
# Format:
|
||||
# - Fields in a mapping entry are semi-colon separated
|
||||
# - New mapping entries are delimited by a new line
|
||||
#
|
||||
437;437
|
||||
arabic;28596
|
||||
asmo-708;708
|
||||
big5;950
|
||||
big5-hkscs;950
|
||||
ccsid00858;858
|
||||
ccsid00924;20924
|
||||
ccsid01140;1140
|
||||
ccsid01141;1141
|
||||
ccsid01142;1142
|
||||
ccsid01143;1143
|
||||
ccsid01144;1144
|
||||
ccsid01145;1145
|
||||
ccsid01146;1146
|
||||
ccsid01147;1147
|
||||
ccsid01148;1148
|
||||
ccsid01149;1149
|
||||
chinese;936
|
||||
cn-big5;950
|
||||
cn-gb;936
|
||||
cp00858;858
|
||||
cp00924;20924
|
||||
cp01140;1140
|
||||
cp01141;1141
|
||||
cp01142;1142
|
||||
cp01143;1143
|
||||
cp01144;1144
|
||||
cp01145;1145
|
||||
cp01146;1146
|
||||
cp01147;1147
|
||||
cp01148;1148
|
||||
cp01149;1149
|
||||
cp037;37
|
||||
cp1025;21025
|
||||
cp1026;1026
|
||||
cp1256;1256
|
||||
cp273;20273
|
||||
cp278;20278
|
||||
cp280;20280
|
||||
cp284;20284
|
||||
cp285;20285
|
||||
cp290;20290
|
||||
cp297;20297
|
||||
cp420;20420
|
||||
cp423;20423
|
||||
cp424;20424
|
||||
cp437;437
|
||||
cp500;500
|
||||
cp50227;50227
|
||||
cp850;850
|
||||
cp852;852
|
||||
cp855;855
|
||||
cp857;857
|
||||
cp858;858
|
||||
cp860;860
|
||||
cp861;861
|
||||
cp862;862
|
||||
cp863;863
|
||||
cp864;864
|
||||
cp865;865
|
||||
cp866;866
|
||||
cp869;869
|
||||
cp870;870
|
||||
cp871;20871
|
||||
cp875;875
|
||||
cp880;20880
|
||||
cp905;20905
|
||||
csbig5;950
|
||||
cseuckr;51949
|
||||
cseucpkdfmtjapanese;51932
|
||||
csgb2312;936
|
||||
csgb231280;936
|
||||
csibm037;37
|
||||
csibm1026;1026
|
||||
csibm273;20273
|
||||
csibm277;20277
|
||||
csibm278;20278
|
||||
csibm280;20280
|
||||
csibm284;20284
|
||||
csibm285;20285
|
||||
csibm290;20290
|
||||
csibm297;20297
|
||||
csibm420;20420
|
||||
csibm423;20423
|
||||
csibm424;20424
|
||||
csibm500;500
|
||||
csibm870;870
|
||||
csibm871;20871
|
||||
csibm880;20880
|
||||
csibm905;20905
|
||||
csibmthai;20838
|
||||
csiso2022jp;50221
|
||||
csiso2022kr;50225
|
||||
csiso58gb231280;936
|
||||
csisolatin2;28592
|
||||
csisolatin3;28593
|
||||
csisolatin4;28594
|
||||
csisolatin5;28599
|
||||
csisolatin9;28605
|
||||
csisolatinarabic;28596
|
||||
csisolatincyrillic;28595
|
||||
csisolatingreek;28597
|
||||
csisolatinhebrew;28598
|
||||
cskoi8r;20866
|
||||
csksc56011987;949
|
||||
cspc8codepage437;437
|
||||
csshiftjis;932
|
||||
cswindows31j;932
|
||||
cyrillic;28595
|
||||
din_66003;20106
|
||||
dos-720;720
|
||||
dos-862;862
|
||||
dos-874;874
|
||||
ebcdic-cp-ar1;20420
|
||||
ebcdic-cp-be;500
|
||||
ebcdic-cp-ca;37
|
||||
ebcdic-cp-ch;500
|
||||
ebcdic-cp-dk;20277
|
||||
ebcdic-cp-es;20284
|
||||
ebcdic-cp-fi;20278
|
||||
ebcdic-cp-fr;20297
|
||||
ebcdic-cp-gb;20285
|
||||
ebcdic-cp-gr;20423
|
||||
ebcdic-cp-he;20424
|
||||
ebcdic-cp-is;20871
|
||||
ebcdic-cp-it;20280
|
||||
ebcdic-cp-nl;37
|
||||
ebcdic-cp-no;20277
|
||||
ebcdic-cp-roece;870
|
||||
ebcdic-cp-se;20278
|
||||
ebcdic-cp-tr;20905
|
||||
ebcdic-cp-us;37
|
||||
ebcdic-cp-wt;37
|
||||
ebcdic-cp-yu;870
|
||||
ebcdic-cyrillic;20880
|
||||
ebcdic-de-273+euro;1141
|
||||
ebcdic-dk-277+euro;1142
|
||||
ebcdic-es-284+euro;1145
|
||||
ebcdic-fi-278+euro;1143
|
||||
ebcdic-fr-297+euro;1147
|
||||
ebcdic-gb-285+euro;1146
|
||||
ebcdic-international-500+euro;1148
|
||||
ebcdic-is-871+euro;1149
|
||||
ebcdic-it-280+euro;1144
|
||||
ebcdic-jp-kana;20290
|
||||
ebcdic-latin9--euro;20924
|
||||
ebcdic-no-277+euro;1142
|
||||
ebcdic-se-278+euro;1143
|
||||
ebcdic-us-37+euro;1140
|
||||
ecma-114;28596
|
||||
ecma-118;28597
|
||||
elot_928;28597
|
||||
euc-cn;51936
|
||||
euc-jp;51932
|
||||
euc-kr;51949
|
||||
extended_unix_code_packed_format_for_japanese;51932
|
||||
gb18030;54936
|
||||
gb2312;936
|
||||
gb2312-80;936
|
||||
gb231280;936
|
||||
gbk;936
|
||||
gb_2312-80;936
|
||||
german;20106
|
||||
greek;28597
|
||||
greek8;28597
|
||||
hebrew;28598
|
||||
hz-gb-2312;52936
|
||||
ibm-thai;20838
|
||||
ibm00858;858
|
||||
ibm00924;20924
|
||||
ibm01047;1047
|
||||
ibm01140;1140
|
||||
ibm01141;1141
|
||||
ibm01142;1142
|
||||
ibm01143;1143
|
||||
ibm01144;1144
|
||||
ibm01145;1145
|
||||
ibm01146;1146
|
||||
ibm01147;1147
|
||||
ibm01148;1148
|
||||
ibm01149;1149
|
||||
ibm037;37
|
||||
ibm1026;1026
|
||||
ibm273;20273
|
||||
ibm277;20277
|
||||
ibm278;20278
|
||||
ibm280;20280
|
||||
ibm284;20284
|
||||
ibm285;20285
|
||||
ibm290;20290
|
||||
ibm297;20297
|
||||
ibm420;20420
|
||||
ibm423;20423
|
||||
ibm424;20424
|
||||
ibm437;437
|
||||
ibm500;500
|
||||
ibm737;737
|
||||
ibm775;775
|
||||
ibm850;850
|
||||
ibm852;852
|
||||
ibm855;855
|
||||
ibm857;857
|
||||
ibm860;860
|
||||
ibm861;861
|
||||
ibm862;862
|
||||
ibm863;863
|
||||
ibm864;864
|
||||
ibm865;865
|
||||
ibm866;866
|
||||
ibm869;869
|
||||
ibm870;870
|
||||
ibm871;20871
|
||||
ibm880;20880
|
||||
ibm905;20905
|
||||
irv;20105
|
||||
iso-2022-jp;50220
|
||||
iso-2022-jpeuc;51932
|
||||
iso-2022-kr;50225
|
||||
iso-2022-kr-7;50225
|
||||
iso-2022-kr-7bit;50225
|
||||
iso-2022-kr-8;51949
|
||||
iso-2022-kr-8bit;51949
|
||||
iso-8859-11;874
|
||||
iso-8859-13;28603
|
||||
iso-8859-15;28605
|
||||
iso-8859-2;28592
|
||||
iso-8859-3;28593
|
||||
iso-8859-4;28594
|
||||
iso-8859-5;28595
|
||||
iso-8859-6;28596
|
||||
iso-8859-7;28597
|
||||
iso-8859-8;28598
|
||||
iso-8859-8 visual;28598
|
||||
iso-8859-8-i;38598
|
||||
iso-8859-9;28599
|
||||
iso-ir-101;28592
|
||||
iso-ir-109;28593
|
||||
iso-ir-110;28594
|
||||
iso-ir-126;28597
|
||||
iso-ir-127;28596
|
||||
iso-ir-138;28598
|
||||
iso-ir-144;28595
|
||||
iso-ir-148;28599
|
||||
iso-ir-149;949
|
||||
iso-ir-58;936
|
||||
iso8859-2;28592
|
||||
iso_8859-15;28605
|
||||
iso_8859-2;28592
|
||||
iso_8859-2:1987;28592
|
||||
iso_8859-3;28593
|
||||
iso_8859-3:1988;28593
|
||||
iso_8859-4;28594
|
||||
iso_8859-4:1988;28594
|
||||
iso_8859-5;28595
|
||||
iso_8859-5:1988;28595
|
||||
iso_8859-6;28596
|
||||
iso_8859-6:1987;28596
|
||||
iso_8859-7;28597
|
||||
iso_8859-7:1987;28597
|
||||
iso_8859-8;28598
|
||||
iso_8859-8:1988;28598
|
||||
iso_8859-9;28599
|
||||
iso_8859-9:1989;28599
|
||||
johab;1361
|
||||
koi;20866
|
||||
koi8;20866
|
||||
koi8-r;20866
|
||||
koi8-ru;21866
|
||||
koi8-u;21866
|
||||
koi8r;20866
|
||||
korean;949
|
||||
ks-c-5601;949
|
||||
ks-c5601;949
|
||||
ksc5601;949
|
||||
ksc_5601;949
|
||||
ks_c_5601;949
|
||||
ks_c_5601-1987;949
|
||||
ks_c_5601-1989;949
|
||||
ks_c_5601_1987;949
|
||||
l2;28592
|
||||
l3;28593
|
||||
l4;28594
|
||||
l5;28599
|
||||
l9;28605
|
||||
latin2;28592
|
||||
latin3;28593
|
||||
latin4;28594
|
||||
latin5;28599
|
||||
latin9;28605
|
||||
logical;28598
|
||||
macintosh;10000
|
||||
ms_kanji;932
|
||||
norwegian;20108
|
||||
ns_4551-1;20108
|
||||
pc-multilingual-850+euro;858
|
||||
sen_850200_b;20107
|
||||
shift-jis;932
|
||||
shift_jis;932
|
||||
sjis;932
|
||||
swedish;20107
|
||||
tis-620;874
|
||||
visual;28598
|
||||
windows-1250;1250
|
||||
windows-1251;1251
|
||||
windows-1252;1252
|
||||
windows-1253;1253
|
||||
windows-1254;1254
|
||||
windows-1255;1255
|
||||
windows-1256;1256
|
||||
windows-1257;1257
|
||||
windows-1258;1258
|
||||
windows-874;874
|
||||
x-ansi;1252
|
||||
x-chinese-cns;20000
|
||||
x-chinese-eten;20002
|
||||
x-cp1250;1250
|
||||
x-cp1251;1251
|
||||
x-cp20001;20001
|
||||
x-cp20003;20003
|
||||
x-cp20004;20004
|
||||
x-cp20005;20005
|
||||
x-cp20261;20261
|
||||
x-cp20269;20269
|
||||
x-cp20936;20936
|
||||
x-cp20949;20949
|
||||
x-cp50227;50227
|
||||
x-ebcdic-koreanextended;20833
|
||||
x-euc;51932
|
||||
x-euc-cn;51936
|
||||
x-euc-jp;51932
|
||||
x-europa;29001
|
||||
x-ia5;20105
|
||||
x-ia5-german;20106
|
||||
x-ia5-norwegian;20108
|
||||
x-ia5-swedish;20107
|
||||
x-iscii-as;57006
|
||||
x-iscii-be;57003
|
||||
x-iscii-de;57002
|
||||
x-iscii-gu;57010
|
||||
x-iscii-ka;57008
|
||||
x-iscii-ma;57009
|
||||
x-iscii-or;57007
|
||||
x-iscii-pa;57011
|
||||
x-iscii-ta;57004
|
||||
x-iscii-te;57005
|
||||
x-mac-arabic;10004
|
||||
x-mac-ce;10029
|
||||
x-mac-chinesesimp;10008
|
||||
x-mac-chinesetrad;10002
|
||||
x-mac-croatian;10082
|
||||
x-mac-cyrillic;10007
|
||||
x-mac-greek;10006
|
||||
x-mac-hebrew;10005
|
||||
x-mac-icelandic;10079
|
||||
x-mac-japanese;10001
|
||||
x-mac-korean;10003
|
||||
x-mac-romanian;10010
|
||||
x-mac-thai;10021
|
||||
x-mac-turkish;10081
|
||||
x-mac-ukrainian;10017
|
||||
x-ms-cp932;932
|
||||
x-sjis;932
|
||||
x-x-big5;950
|
|
142
external/corefx/src/System.Text.Encoding.CodePages/src/Data/PreferredCodePageNames.csv
vendored
Normal file
142
external/corefx/src/System.Text.Encoding.CodePages/src/Data/PreferredCodePageNames.csv
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
#
|
||||
# This file contains data for mapping from mapping from code page numbers to their preferred IANA encoding names
|
||||
# and English names (we do not currently localize ProjectN libraries)
|
||||
#
|
||||
# This can be used as input to the EncodingData tool when generating EncodingTable.Data.cs
|
||||
#
|
||||
# Format:
|
||||
# - Fields in a mapping entry are semi-colon separated
|
||||
# - New mapping entries are delimited by a new line
|
||||
#
|
||||
37;ibm037;IBM EBCDIC (US-Canada)
|
||||
437;ibm437;OEM United States
|
||||
500;ibm500;IBM EBCDIC (International)
|
||||
708;asmo-708;Arabic (ASMO 708)
|
||||
720;dos-720;Arabic (DOS)
|
||||
737;ibm737;Greek (DOS)
|
||||
775;ibm775;Baltic (DOS)
|
||||
850;ibm850;Western European (DOS)
|
||||
852;ibm852;Central European (DOS)
|
||||
855;ibm855;OEM Cyrillic
|
||||
857;ibm857;Turkish (DOS)
|
||||
858;ibm00858;OEM Multilingual Latin I
|
||||
860;ibm860;Portuguese (DOS)
|
||||
861;ibm861;Icelandic (DOS)
|
||||
862;dos-862;Hebrew (DOS)
|
||||
863;ibm863;French Canadian (DOS)
|
||||
864;ibm864;Arabic (864)
|
||||
865;ibm865;Nordic (DOS)
|
||||
866;cp866;Cyrillic (DOS)
|
||||
869;ibm869;Greek, Modern (DOS)
|
||||
870;ibm870;IBM EBCDIC (Multilingual Latin-2)
|
||||
874;windows-874;Thai (Windows)
|
||||
875;cp875;IBM EBCDIC (Greek Modern)
|
||||
932;shift_jis;Japanese (Shift-JIS)
|
||||
936;gb2312;Chinese Simplified (GB2312)
|
||||
949;ks_c_5601-1987;Korean
|
||||
950;big5;Chinese Traditional (Big5)
|
||||
1026;ibm1026;IBM EBCDIC (Turkish Latin-5)
|
||||
1047;ibm01047;IBM Latin-1
|
||||
1140;ibm01140;IBM EBCDIC (US-Canada-Euro)
|
||||
1141;ibm01141;IBM EBCDIC (Germany-Euro)
|
||||
1142;ibm01142;IBM EBCDIC (Denmark-Norway-Euro)
|
||||
1143;ibm01143;IBM EBCDIC (Finland-Sweden-Euro)
|
||||
1144;ibm01144;IBM EBCDIC (Italy-Euro)
|
||||
1145;ibm01145;IBM EBCDIC (Spain-Euro)
|
||||
1146;ibm01146;IBM EBCDIC (UK-Euro)
|
||||
1147;ibm01147;IBM EBCDIC (France-Euro)
|
||||
1148;ibm01148;IBM EBCDIC (International-Euro)
|
||||
1149;ibm01149;IBM EBCDIC (Icelandic-Euro)
|
||||
1250;windows-1250;Central European (Windows)
|
||||
1251;windows-1251;Cyrillic (Windows)
|
||||
1252;windows-1252;Western European (Windows)
|
||||
1253;windows-1253;Greek (Windows)
|
||||
1254;windows-1254;Turkish (Windows)
|
||||
1255;windows-1255;Hebrew (Windows)
|
||||
1256;windows-1256;Arabic (Windows)
|
||||
1257;windows-1257;Baltic (Windows)
|
||||
1258;windows-1258;Vietnamese (Windows)
|
||||
1361;johab;Korean (Johab)
|
||||
10000;macintosh;Western European (Mac)
|
||||
10001;x-mac-japanese;Japanese (Mac)
|
||||
10002;x-mac-chinesetrad;Chinese Traditional (Mac)
|
||||
10003;x-mac-korean;Korean (Mac)
|
||||
10004;x-mac-arabic;Arabic (Mac)
|
||||
10005;x-mac-hebrew;Hebrew (Mac)
|
||||
10006;x-mac-greek;Greek (Mac)
|
||||
10007;x-mac-cyrillic;Cyrillic (Mac)
|
||||
10008;x-mac-chinesesimp;Chinese Simplified (Mac)
|
||||
10010;x-mac-romanian;Romanian (Mac)
|
||||
10017;x-mac-ukrainian;Ukrainian (Mac)
|
||||
10021;x-mac-thai;Thai (Mac)
|
||||
10029;x-mac-ce;Central European (Mac)
|
||||
10079;x-mac-icelandic;Icelandic (Mac)
|
||||
10081;x-mac-turkish;Turkish (Mac)
|
||||
10082;x-mac-croatian;Croatian (Mac)
|
||||
20000;x-chinese-cns;Chinese Traditional (CNS)
|
||||
20001;x-cp20001;TCA Taiwan
|
||||
20002;x-chinese-eten;Chinese Traditional (Eten)
|
||||
20003;x-cp20003;IBM5550 Taiwan
|
||||
20004;x-cp20004;TeleText Taiwan
|
||||
20005;x-cp20005;Wang Taiwan
|
||||
20105;x-ia5;Western European (IA5)
|
||||
20106;x-ia5-german;German (IA5)
|
||||
20107;x-ia5-swedish;Swedish (IA5)
|
||||
20108;x-ia5-norwegian;Norwegian (IA5)
|
||||
20261;x-cp20261;T.61
|
||||
20269;x-cp20269;ISO-6937
|
||||
20273;ibm273;IBM EBCDIC (Germany)
|
||||
20277;ibm277;IBM EBCDIC (Denmark-Norway)
|
||||
20278;ibm278;IBM EBCDIC (Finland-Sweden)
|
||||
20280;ibm280;IBM EBCDIC (Italy)
|
||||
20284;ibm284;IBM EBCDIC (Spain)
|
||||
20285;ibm285;IBM EBCDIC (UK)
|
||||
20290;ibm290;IBM EBCDIC (Japanese katakana)
|
||||
20297;ibm297;IBM EBCDIC (France)
|
||||
20420;ibm420;IBM EBCDIC (Arabic)
|
||||
20423;ibm423;IBM EBCDIC (Greek)
|
||||
20424;ibm424;IBM EBCDIC (Hebrew)
|
||||
20833;x-ebcdic-koreanextended;IBM EBCDIC (Korean Extended)
|
||||
20838;ibm-thai;IBM EBCDIC (Thai)
|
||||
20866;koi8-r;Cyrillic (KOI8-R)
|
||||
20871;ibm871;IBM EBCDIC (Icelandic)
|
||||
20880;ibm880;IBM EBCDIC (Cyrillic Russian)
|
||||
20905;ibm905;IBM EBCDIC (Turkish)
|
||||
20924;ibm00924;IBM Latin-1
|
||||
20932;euc-jp;Japanese (JIS 0208-1990 and 0212-1990)
|
||||
20936;x-cp20936;Chinese Simplified (GB2312-80)
|
||||
20949;x-cp20949;Korean Wansung
|
||||
21025;cp1025;IBM EBCDIC (Cyrillic Serbian-Bulgarian)
|
||||
21866;koi8-u;Cyrillic (KOI8-U)
|
||||
28592;iso-8859-2;Central European (ISO)
|
||||
28593;iso-8859-3;Latin 3 (ISO)
|
||||
28594;iso-8859-4;Baltic (ISO)
|
||||
28595;iso-8859-5;Cyrillic (ISO)
|
||||
28596;iso-8859-6;Arabic (ISO)
|
||||
28597;iso-8859-7;Greek (ISO)
|
||||
28598;iso-8859-8;Hebrew (ISO-Visual)
|
||||
28599;iso-8859-9;Turkish (ISO)
|
||||
28603;iso-8859-13;Estonian (ISO)
|
||||
28605;iso-8859-15;Latin 9 (ISO)
|
||||
29001;x-europa;Europa
|
||||
38598;iso-8859-8-i;Hebrew (ISO-Logical)
|
||||
50220;iso-2022-jp;Japanese (JIS)
|
||||
50221;csiso2022jp;Japanese (JIS-Allow 1 byte Kana)
|
||||
50222;iso-2022-jp;Japanese (JIS-Allow 1 byte Kana - SO/SI)
|
||||
50225;iso-2022-kr;Korean (ISO)
|
||||
50227;x-cp50227;Chinese Simplified (ISO-2022)
|
||||
51932;euc-jp;Japanese (EUC)
|
||||
51936;euc-cn;Chinese Simplified (EUC)
|
||||
51949;euc-kr;Korean (EUC)
|
||||
52936;hz-gb-2312;Chinese Simplified (HZ)
|
||||
54936;gb18030;Chinese Simplified (GB18030)
|
||||
57002;x-iscii-de;ISCII Devanagari
|
||||
57003;x-iscii-be;ISCII Bengali
|
||||
57004;x-iscii-ta;ISCII Tamil
|
||||
57005;x-iscii-te;ISCII Telugu
|
||||
57006;x-iscii-as;ISCII Assamese
|
||||
57007;x-iscii-or;ISCII Oriya
|
||||
57008;x-iscii-ka;ISCII Kannada
|
||||
57009;x-iscii-ma;ISCII Malayalam
|
||||
57010;x-iscii-gu;ISCII Gujarati
|
||||
57011;x-iscii-pa;ISCII Punjabi
|
Can't render this file because it has a wrong number of fields in line 30.
|
1
external/corefx/src/System.Text.Encoding.CodePages/src/Data/codepages.nlp.REMOVED.git-id
vendored
Normal file
1
external/corefx/src/System.Text.Encoding.CodePages/src/Data/codepages.nlp.REMOVED.git-id
vendored
Normal file
@ -0,0 +1 @@
|
||||
eb9fb0b74df89f66065fe107e2602316cedd01f0
|
@ -0,0 +1,37 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace Microsoft.Win32.SafeHandles
|
||||
{
|
||||
[SecurityCritical]
|
||||
internal sealed class SafeAllocHHandle : SafeBuffer
|
||||
{
|
||||
private SafeAllocHHandle() : base(true) { }
|
||||
|
||||
internal SafeAllocHHandle(IntPtr handle) : base(true)
|
||||
{
|
||||
SetHandle(handle);
|
||||
}
|
||||
|
||||
internal static SafeAllocHHandle InvalidHandle
|
||||
{
|
||||
get { return new SafeAllocHHandle(IntPtr.Zero); }
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical]
|
||||
override protected bool ReleaseHandle()
|
||||
{
|
||||
if (handle != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(handle);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
597
external/corefx/src/System.Text.Encoding.CodePages/src/Resources/Strings.resx
vendored
Normal file
597
external/corefx/src/System.Text.Encoding.CodePages/src/Resources/Strings.resx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
84
external/corefx/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj
vendored
Normal file
84
external/corefx/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{16EE6633-F557-5C9E-9EF3-B5334B044F47}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>System.Text.Encoding.CodePages</RootNamespace>
|
||||
<AssemblyName>System.Text.Encoding.CodePages</AssemblyName>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="Microsoft\Win32\SafeHandles\SafeAllocHHandle.cs" />
|
||||
<Compile Include="System\Text\BaseCodePageEncoding.cs" />
|
||||
<Compile Include="System\Text\CodePagesEncodingProvider.cs" />
|
||||
<Compile Include="System\Text\DBCSCodePageEncoding.cs" />
|
||||
<Compile Include="System\Text\DecoderBestFitFallback.cs" />
|
||||
<Compile Include="System\Text\DecoderFallbackBufferHelper.cs" />
|
||||
<Compile Include="System\Text\DecoderNLS.cs" />
|
||||
<Compile Include="System\Text\EncoderBestFitFallback.cs" />
|
||||
<Compile Include="System\Text\EncoderFallbackBufferHelper.cs" />
|
||||
<Compile Include="System\Text\EncoderNLS.cs" />
|
||||
<Compile Include="System\Text\EncodingByteBuffer.cs" />
|
||||
<Compile Include="System\Text\EncodingCharBuffer.cs" />
|
||||
<Compile Include="System\Text\EncodingNLS.cs" />
|
||||
<Compile Include="System\Text\EncodingTable.cs" />
|
||||
<Compile Include="System\Text\EncodingTable.Data.cs" />
|
||||
<Compile Include="System\Text\EUCJPEncoding.cs" />
|
||||
<Compile Include="System\Text\GB18030Encoding.cs" />
|
||||
<Compile Include="System\Text\ISO2022Encoding.cs" />
|
||||
<Compile Include="System\Text\ISCIIEncoding.cs" />
|
||||
<Compile Include="System\Text\SBCSCodePageEncoding.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
|
||||
<Compile Include="System\Text\CodePagesEncodingProvider.Windows.cs" />
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.Encoding.Constants.cs">
|
||||
<Link>Common\Interop\Windows\kernel32\Interop.Encoding.Constants.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
|
||||
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetCPInfoEx.cs">
|
||||
<Link>Common\Interop\Windows\Interop.GetCPInfoEx.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
|
||||
<Compile Include="System\Text\CodePagesEncodingProvider.Unix.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\codepages.nlp">
|
||||
<LogicalName>codepages.nlp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Data\CodePageNameMappings.csv" />
|
||||
<None Include="Data\PreferredCodePageNames.csv" />
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Diagnostics.Contracts" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Runtime.InteropServices" />
|
||||
<Reference Include="System.Threading" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
<!-- Generator for code mapping table, target to invoke is GenerateEncodingSource -->
|
||||
<PropertyGroup>
|
||||
<!-- This Task can be re-run with /t:GenerateEncodingSource
|
||||
An IANA Mapping file contains rows of two elements: a valid IANA encoding identifier, and the equivalent code page.
|
||||
There may be many IANA ids (aliases) mapped to a single code page. -->
|
||||
<IANAMappingPath>Data\CodePageNameMappings.csv</IANAMappingPath>
|
||||
<!-- The preferred name file contains rows of three elements: a code page, the 'canonical' IANA identifier,
|
||||
and an "English" or descriptive name. There is one row per code page. -->
|
||||
<PreferredIANANamesPath>Data\PreferredCodePageNames.csv</PreferredIANANamesPath>
|
||||
<OutputDataTablePath>System\Text\EncodingTable.Data.cs</OutputDataTablePath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(ToolsDir)encoding.targets" Condition="Exists('$(ToolsDir)encoding.targets')" />
|
||||
</Project>
|
358
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
vendored
Normal file
358
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
vendored
Normal file
@ -0,0 +1,358 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
// Our input file data structures look like:
|
||||
//
|
||||
// Header structure looks like:
|
||||
// struct NLSPlusHeader
|
||||
// {
|
||||
// WORD[16] filename; // 32 bytes
|
||||
// WORD[4] version; // 8 bytes = 40 // e.g.: 3, 2, 0, 0
|
||||
// WORD count; // 2 bytes = 42 // Number of code page indexes that will follow
|
||||
// }
|
||||
//
|
||||
// Each code page section looks like:
|
||||
// struct NLSCodePageIndex
|
||||
// {
|
||||
// WORD[16] codePageName; // 32 bytes
|
||||
// WORD codePage; // +2 bytes = 34
|
||||
// WORD byteCount; // +2 bytes = 36
|
||||
// DWORD offset; // +4 bytes = 40 // Bytes from beginning of FILE.
|
||||
// }
|
||||
//
|
||||
// Each code page then has its own header
|
||||
// struct NLSCodePage
|
||||
// {
|
||||
// WORD[16] codePageName; // 32 bytes
|
||||
// WORD[4] version; // 8 bytes = 40 // e.g.: 3.2.0.0
|
||||
// WORD codePage; // 2 bytes = 42
|
||||
// WORD byteCount; // 2 bytes = 44 // 1 or 2 byte code page (SBCS or DBCS)
|
||||
// WORD unicodeReplace; // 2 bytes = 46 // default replacement unicode character
|
||||
// WORD byteReplace; // 2 bytes = 48 // default replacement byte(s)
|
||||
// BYTE[] data; // data section
|
||||
// }
|
||||
[Serializable]
|
||||
internal abstract class BaseCodePageEncoding : EncodingNLS, ISerializable
|
||||
{
|
||||
internal const String CODE_PAGE_DATA_FILE_NAME = "codepages.nlp";
|
||||
|
||||
protected int dataTableCodePage;
|
||||
|
||||
// Variables to help us allocate/mark our memory section correctly
|
||||
protected int iExtraBytes = 0;
|
||||
|
||||
// Our private unicode-to-bytes best-fit-array, and vice versa.
|
||||
protected char[] arrayUnicodeBestFit = null;
|
||||
protected char[] arrayBytesBestFit = null;
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal BaseCodePageEncoding(int codepage)
|
||||
: this(codepage, codepage)
|
||||
{
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal BaseCodePageEncoding(int codepage, int dataCodePage)
|
||||
: base(codepage, new InternalEncoderBestFitFallback(null), new InternalDecoderBestFitFallback(null))
|
||||
{
|
||||
SetFallbackEncoding();
|
||||
// Remember number of code pages that we'll be using the table for.
|
||||
dataTableCodePage = dataCodePage;
|
||||
LoadCodePageTables();
|
||||
}
|
||||
|
||||
internal BaseCodePageEncoding(int codepage, int dataCodePage, EncoderFallback enc, DecoderFallback dec)
|
||||
: base(codepage, enc, dec)
|
||||
{
|
||||
// Remember number of code pages that we'll be using the table for.
|
||||
dataTableCodePage = dataCodePage;
|
||||
LoadCodePageTables();
|
||||
}
|
||||
|
||||
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
CodePageEncodingSurrogate.SerializeEncoding(this, info, context);
|
||||
info.SetType(typeof(CodePageEncodingSurrogate));
|
||||
}
|
||||
|
||||
// Just a helper as we cannot use 'this' when calling 'base(...)'
|
||||
private void SetFallbackEncoding()
|
||||
{
|
||||
(EncoderFallback as InternalEncoderBestFitFallback).encoding = this;
|
||||
(DecoderFallback as InternalDecoderBestFitFallback).encoding = this;
|
||||
}
|
||||
|
||||
//
|
||||
// This is the header for the native data table that we load from CODE_PAGE_DATA_FILE_NAME.
|
||||
//
|
||||
// Explicit layout is used here since a syntax like char[16] can not be used in sequential layout.
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
internal struct CodePageDataFileHeader
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal char TableName; // WORD[16]
|
||||
[FieldOffset(0x20)]
|
||||
internal ushort Version; // WORD[4]
|
||||
[FieldOffset(0x28)]
|
||||
internal short CodePageCount; // WORD
|
||||
[FieldOffset(0x2A)]
|
||||
internal short unused1; // Add an unused WORD so that CodePages is aligned with DWORD boundary.
|
||||
}
|
||||
private const int CODEPAGE_DATA_FILE_HEADER_SIZE = 44;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 2)]
|
||||
internal unsafe struct CodePageIndex
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal char CodePageName; // WORD[16]
|
||||
[FieldOffset(0x20)]
|
||||
internal short CodePage; // WORD
|
||||
[FieldOffset(0x22)]
|
||||
internal short ByteCount; // WORD
|
||||
[FieldOffset(0x24)]
|
||||
internal int Offset; // DWORD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
internal unsafe struct CodePageHeader
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
internal char CodePageName; // WORD[16]
|
||||
[FieldOffset(0x20)]
|
||||
internal ushort VersionMajor; // WORD
|
||||
[FieldOffset(0x22)]
|
||||
internal ushort VersionMinor; // WORD
|
||||
[FieldOffset(0x24)]
|
||||
internal ushort VersionRevision;// WORD
|
||||
[FieldOffset(0x26)]
|
||||
internal ushort VersionBuild; // WORD
|
||||
[FieldOffset(0x28)]
|
||||
internal short CodePage; // WORD
|
||||
[FieldOffset(0x2a)]
|
||||
internal short ByteCount; // WORD // 1 or 2 byte code page (SBCS or DBCS)
|
||||
[FieldOffset(0x2c)]
|
||||
internal char UnicodeReplace; // WORD // default replacement unicode character
|
||||
[FieldOffset(0x2e)]
|
||||
internal ushort ByteReplace; // WORD // default replacement bytes
|
||||
}
|
||||
private const int CODEPAGE_HEADER_SIZE = 48;
|
||||
|
||||
// Initialize our global stuff
|
||||
private static byte[] s_codePagesDataHeader = new byte[CODEPAGE_DATA_FILE_HEADER_SIZE];
|
||||
protected static Stream s_codePagesEncodingDataStream = GetEncodingDataStream(CODE_PAGE_DATA_FILE_NAME);
|
||||
protected static readonly Object s_streamLock = new Object(); // this lock used when reading from s_codePagesEncodingDataStream
|
||||
|
||||
// Real variables
|
||||
protected byte[] m_codePageHeader = new byte[CODEPAGE_HEADER_SIZE];
|
||||
protected int m_firstDataWordOffset;
|
||||
protected int m_dataSize;
|
||||
|
||||
// Safe handle wrapper around section map view
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
protected SafeAllocHHandle safeNativeMemoryHandle = null;
|
||||
|
||||
internal static Stream GetEncodingDataStream(String tableName)
|
||||
{
|
||||
Debug.Assert(tableName != null, "table name can not be null");
|
||||
|
||||
// NOTE: We must reflect on a public type that is exposed in the contract here
|
||||
// (i.e. CodePagesEncodingProvider), otherwise we will not get a reference to
|
||||
// the right assembly.
|
||||
Stream stream = typeof(CodePagesEncodingProvider).GetTypeInfo().Assembly.GetManifestResourceStream(tableName);
|
||||
|
||||
if (stream == null)
|
||||
{
|
||||
// We can not continue if we can't get the resource.
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
// Read the header
|
||||
stream.Read(s_codePagesDataHeader, 0, s_codePagesDataHeader.Length);
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
// We need to load tables for our code page
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
private unsafe void LoadCodePageTables()
|
||||
{
|
||||
if (!FindCodePage(dataTableCodePage))
|
||||
{
|
||||
// Didn't have one
|
||||
throw new NotSupportedException(SR.Format(SR.NotSupported_NoCodepageData, CodePage));
|
||||
}
|
||||
|
||||
// We had it, so load it
|
||||
LoadManagedCodePage();
|
||||
}
|
||||
|
||||
// Look up the code page pointer
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
private unsafe bool FindCodePage(int codePage)
|
||||
{
|
||||
Debug.Assert(m_codePageHeader != null && m_codePageHeader.Length == CODEPAGE_HEADER_SIZE, "m_codePageHeader expected to match in size the struct CodePageHeader");
|
||||
|
||||
// Loop through all of the m_pCodePageIndex[] items to find our code page
|
||||
byte[] codePageIndex = new byte[sizeof(CodePageIndex)];
|
||||
|
||||
lock (s_streamLock)
|
||||
{
|
||||
// seek to the first CodePageIndex entry
|
||||
s_codePagesEncodingDataStream.Seek(CODEPAGE_DATA_FILE_HEADER_SIZE, SeekOrigin.Begin);
|
||||
|
||||
int codePagesCount;
|
||||
fixed (byte* pBytes = s_codePagesDataHeader)
|
||||
{
|
||||
CodePageDataFileHeader* pDataHeader = (CodePageDataFileHeader*)pBytes;
|
||||
codePagesCount = pDataHeader->CodePageCount;
|
||||
}
|
||||
|
||||
fixed (byte* pBytes = codePageIndex)
|
||||
{
|
||||
CodePageIndex* pCodePageIndex = (CodePageIndex*)pBytes;
|
||||
for (int i = 0; i < codePagesCount; i++)
|
||||
{
|
||||
s_codePagesEncodingDataStream.Read(codePageIndex, 0, codePageIndex.Length);
|
||||
|
||||
if (pCodePageIndex->CodePage == codePage)
|
||||
{
|
||||
// Found it!
|
||||
long position = s_codePagesEncodingDataStream.Position;
|
||||
s_codePagesEncodingDataStream.Seek((long)pCodePageIndex->Offset, SeekOrigin.Begin);
|
||||
s_codePagesEncodingDataStream.Read(m_codePageHeader, 0, m_codePageHeader.Length);
|
||||
m_firstDataWordOffset = (int)s_codePagesEncodingDataStream.Position; // stream now pointing to the codepage data
|
||||
|
||||
if (i == codePagesCount - 1) // last codepage
|
||||
{
|
||||
m_dataSize = (int)(s_codePagesEncodingDataStream.Length - pCodePageIndex->Offset - m_codePageHeader.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read Next codepage data to get the offset and then calculate the size
|
||||
s_codePagesEncodingDataStream.Seek(position, SeekOrigin.Begin);
|
||||
int currentOffset = pCodePageIndex->Offset;
|
||||
s_codePagesEncodingDataStream.Read(codePageIndex, 0, codePageIndex.Length);
|
||||
m_dataSize = pCodePageIndex->Offset - currentOffset - m_codePageHeader.Length;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't find it
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get our code page byte count
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal static unsafe int GetCodePageByteSize(int codePage)
|
||||
{
|
||||
// Loop through all of the m_pCodePageIndex[] items to find our code page
|
||||
byte[] codePageIndex = new byte[sizeof(CodePageIndex)];
|
||||
|
||||
lock (s_streamLock)
|
||||
{
|
||||
// seek to the first CodePageIndex entry
|
||||
s_codePagesEncodingDataStream.Seek(CODEPAGE_DATA_FILE_HEADER_SIZE, SeekOrigin.Begin);
|
||||
|
||||
int codePagesCount;
|
||||
fixed (byte* pBytes = s_codePagesDataHeader)
|
||||
{
|
||||
CodePageDataFileHeader* pDataHeader = (CodePageDataFileHeader*)pBytes;
|
||||
codePagesCount = pDataHeader->CodePageCount;
|
||||
}
|
||||
|
||||
fixed (byte* pBytes = codePageIndex)
|
||||
{
|
||||
CodePageIndex* pCodePageIndex = (CodePageIndex*)pBytes;
|
||||
for (int i = 0; i < codePagesCount; i++)
|
||||
{
|
||||
s_codePagesEncodingDataStream.Read(codePageIndex, 0, codePageIndex.Length);
|
||||
|
||||
if (pCodePageIndex->CodePage == codePage)
|
||||
{
|
||||
Debug.Assert(pCodePageIndex->ByteCount == 1 || pCodePageIndex->ByteCount == 2,
|
||||
"[BaseCodePageEncoding] Code page (" + codePage + ") has invalid byte size (" + pCodePageIndex->ByteCount + ") in table");
|
||||
// Return what it says for byte count
|
||||
return pCodePageIndex->ByteCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't find it
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We have a managed code page entry, so load our tables
|
||||
[System.Security.SecurityCritical]
|
||||
protected abstract unsafe void LoadManagedCodePage();
|
||||
|
||||
// Allocate memory to load our code page
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
protected unsafe byte* GetNativeMemory(int iSize)
|
||||
{
|
||||
if (safeNativeMemoryHandle == null)
|
||||
{
|
||||
byte* pNativeMemory = (byte*)Marshal.AllocHGlobal(iSize);
|
||||
Debug.Assert(pNativeMemory != null);
|
||||
|
||||
safeNativeMemoryHandle = new SafeAllocHHandle((IntPtr)pNativeMemory);
|
||||
}
|
||||
|
||||
return (byte*)safeNativeMemoryHandle.DangerousGetHandle();
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical]
|
||||
protected abstract unsafe void ReadBestFitTable();
|
||||
|
||||
[System.Security.SecuritySafeCritical]
|
||||
internal char[] GetBestFitUnicodeToBytesData()
|
||||
{
|
||||
// Read in our best fit table if necessary
|
||||
if (arrayUnicodeBestFit == null) ReadBestFitTable();
|
||||
|
||||
Debug.Assert(arrayUnicodeBestFit != null, "[BaseCodePageEncoding.GetBestFitUnicodeToBytesData]Expected non-null arrayUnicodeBestFit");
|
||||
|
||||
// Normally we don't have any best fit data.
|
||||
return arrayUnicodeBestFit;
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical]
|
||||
internal char[] GetBestFitBytesToUnicodeData()
|
||||
{
|
||||
// Read in our best fit table if necessary
|
||||
if (arrayBytesBestFit == null) ReadBestFitTable();
|
||||
|
||||
Debug.Assert(arrayBytesBestFit != null, "[BaseCodePageEncoding.GetBestFitBytesToUnicodeData]Expected non-null arrayBytesBestFit");
|
||||
|
||||
// Normally we don't have any best fit data.
|
||||
return arrayBytesBestFit;
|
||||
}
|
||||
|
||||
// During the AppDomain shutdown the Encoding class may have already finalized, making the memory section
|
||||
// invalid. We detect that by validating the memory section handle then re-initializing the memory
|
||||
// section by calling LoadManagedCodePage() method and eventually the mapped file handle and
|
||||
// the memory section pointer will get finalized one more time.
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal unsafe void CheckMemorySection()
|
||||
{
|
||||
if (safeNativeMemoryHandle != null && safeNativeMemoryHandle.DangerousGetHandle() == IntPtr.Zero)
|
||||
{
|
||||
LoadManagedCodePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
public sealed partial class CodePagesEncodingProvider : EncodingProvider
|
||||
{
|
||||
/// <summary>Get the system default non-unicode code page, or 0 if not available.</summary>
|
||||
private static int SystemDefaultCodePage
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
public sealed partial class CodePagesEncodingProvider : EncodingProvider
|
||||
{
|
||||
/// <summary>Get the system default non-unicode code page, or 0 if not available.</summary>
|
||||
private static int SystemDefaultCodePage
|
||||
{
|
||||
get
|
||||
{
|
||||
int codePage;
|
||||
return Interop.Kernel32.TryGetACPCodePage(out codePage) ? codePage : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
195
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/CodePagesEncodingProvider.cs
vendored
Normal file
195
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/CodePagesEncodingProvider.cs
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
public sealed partial class CodePagesEncodingProvider : EncodingProvider
|
||||
{
|
||||
private static readonly EncodingProvider s_singleton = new CodePagesEncodingProvider();
|
||||
private Dictionary<int, Encoding> _encodings = new Dictionary<int, Encoding>();
|
||||
private ReaderWriterLockSlim _cacheLock = new ReaderWriterLockSlim();
|
||||
|
||||
internal CodePagesEncodingProvider() { }
|
||||
|
||||
public static EncodingProvider Instance
|
||||
{
|
||||
get { return s_singleton; }
|
||||
}
|
||||
|
||||
public override Encoding GetEncoding(int codepage)
|
||||
{
|
||||
if (codepage < 0 || codepage > 65535)
|
||||
return null;
|
||||
|
||||
if (codepage == 0)
|
||||
{
|
||||
// Retrieve the system default non-unicode code page if possible, or return null,
|
||||
// giving the rest of the EncodingProviders a chance to return a default.
|
||||
int systemDefaultCodePage = SystemDefaultCodePage;
|
||||
return systemDefaultCodePage != 0 ?
|
||||
GetEncoding(systemDefaultCodePage) :
|
||||
null;
|
||||
}
|
||||
|
||||
Encoding result = null;
|
||||
|
||||
_cacheLock.EnterUpgradeableReadLock();
|
||||
try
|
||||
{
|
||||
if (_encodings.TryGetValue(codepage, out result))
|
||||
return result;
|
||||
|
||||
int i = BaseCodePageEncoding.GetCodePageByteSize(codepage);
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
result = new SBCSCodePageEncoding(codepage);
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
result = new DBCSCodePageEncoding(codepage);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = GetEncodingRare(codepage);
|
||||
if (result == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
_cacheLock.EnterWriteLock();
|
||||
try
|
||||
{
|
||||
Encoding cachedEncoding;
|
||||
if (_encodings.TryGetValue(codepage, out cachedEncoding))
|
||||
return cachedEncoding;
|
||||
|
||||
_encodings.Add(codepage, result);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_cacheLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_cacheLock.ExitUpgradeableReadLock();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override Encoding GetEncoding(string name)
|
||||
{
|
||||
int codepage = EncodingTable.GetCodePageFromName(name);
|
||||
if (codepage == 0)
|
||||
return null;
|
||||
|
||||
return GetEncoding(codepage);
|
||||
}
|
||||
|
||||
// ISCII
|
||||
private const int ISCIIAssemese = 57006;
|
||||
private const int ISCIIBengali = 57003;
|
||||
private const int ISCIIDevanagari = 57002;
|
||||
private const int ISCIIGujarathi = 57010;
|
||||
private const int ISCIIKannada = 57008;
|
||||
private const int ISCIIMalayalam = 57009;
|
||||
private const int ISCIIOriya = 57007;
|
||||
private const int ISCIIPanjabi = 57011;
|
||||
private const int ISCIITamil = 57004;
|
||||
private const int ISCIITelugu = 57005;
|
||||
|
||||
// ISO 2022 Code Pages
|
||||
private const int ISOKorean = 50225;
|
||||
private const int ChineseHZ = 52936; // HZ has ~}~{~~ sequences
|
||||
private const int ISO2022JP = 50220;
|
||||
private const int ISO2022JPESC = 50221;
|
||||
private const int ISO2022JPSISO = 50222;
|
||||
private const int ISOSimplifiedCN = 50227;
|
||||
private const int EUCJP = 51932;
|
||||
|
||||
// 20936 has same code page as 10008, so we'll special case it
|
||||
private const int CodePageMacGB2312 = 10008;
|
||||
private const int CodePageMacKorean = 10003;
|
||||
private const int CodePageGB2312 = 20936;
|
||||
private const int CodePageDLLKorean = 20949;
|
||||
|
||||
// GB18030
|
||||
private const int GB18030 = 54936;
|
||||
|
||||
// 51936 is the same as 936
|
||||
private const int DuplicateEUCCN = 51936;
|
||||
private const int EUCKR = 51949;
|
||||
private const int EUCCN = 936;
|
||||
|
||||
// Other
|
||||
private const int ISO_8859_8I = 38598;
|
||||
private const int ISO_8859_8_Visual = 28598;
|
||||
|
||||
private static Encoding GetEncodingRare(int codepage)
|
||||
{
|
||||
Encoding result = null;
|
||||
|
||||
switch (codepage)
|
||||
{
|
||||
case ISCIIAssemese:
|
||||
case ISCIIBengali:
|
||||
case ISCIIDevanagari:
|
||||
case ISCIIGujarathi:
|
||||
case ISCIIKannada:
|
||||
case ISCIIMalayalam:
|
||||
case ISCIIOriya:
|
||||
case ISCIIPanjabi:
|
||||
case ISCIITamil:
|
||||
case ISCIITelugu:
|
||||
result = new ISCIIEncoding(codepage);
|
||||
break;
|
||||
// GB2312-80 uses same code page for 20936 and mac 10008
|
||||
case CodePageMacGB2312:
|
||||
// case CodePageGB2312:
|
||||
// result = new DBCSCodePageEncoding(codepage, EUCCN);
|
||||
result = new DBCSCodePageEncoding(CodePageMacGB2312, CodePageGB2312);
|
||||
break;
|
||||
|
||||
// Mac Korean 10003 and 20949 are the same
|
||||
case CodePageMacKorean:
|
||||
result = new DBCSCodePageEncoding(CodePageMacKorean, CodePageDLLKorean);
|
||||
break;
|
||||
// GB18030 Code Pages
|
||||
case GB18030:
|
||||
result = new GB18030Encoding();
|
||||
break;
|
||||
// ISO2022 Code Pages
|
||||
case ISOKorean:
|
||||
// case ISOSimplifiedCN
|
||||
case ChineseHZ:
|
||||
case ISO2022JP: // JIS JP, full-width Katakana mode (no half-width Katakana)
|
||||
case ISO2022JPESC: // JIS JP, esc sequence to do Katakana.
|
||||
case ISO2022JPSISO: // JIS JP with Shift In/ Shift Out Katakana support
|
||||
result = new ISO2022Encoding(codepage);
|
||||
break;
|
||||
// Duplicate EUC-CN (51936) just calls a base code page 936,
|
||||
// so does ISOSimplifiedCN (50227), which has gotta be broken
|
||||
case DuplicateEUCCN:
|
||||
case ISOSimplifiedCN:
|
||||
result = new DBCSCodePageEncoding(codepage, EUCCN); // Just maps to 936
|
||||
break;
|
||||
case EUCJP:
|
||||
result = new EUCJPEncoding();
|
||||
break;
|
||||
case EUCKR:
|
||||
result = new DBCSCodePageEncoding(codepage, CodePageDLLKorean); // Maps to 20949
|
||||
break;
|
||||
case ISO_8859_8I:
|
||||
result = new SBCSCodePageEncoding(codepage, ISO_8859_8_Visual); // Hebrew maps to a different code page
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
1191
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs
vendored
Normal file
1191
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
246
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs
vendored
Normal file
246
external/corefx/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs
vendored
Normal file
@ -0,0 +1,246 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//
|
||||
// This is used internally to create best fit behavior as per the original windows best fit behavior.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
[Serializable]
|
||||
internal sealed class InternalDecoderBestFitFallback : DecoderFallback
|
||||
{
|
||||
// Our variables
|
||||
internal BaseCodePageEncoding encoding = null;
|
||||
internal char[] arrayBestFit = null;
|
||||
internal char cReplacement = '?';
|
||||
|
||||
internal InternalDecoderBestFitFallback(BaseCodePageEncoding _encoding)
|
||||
{
|
||||
// Need to load our replacement characters table.
|
||||
encoding = _encoding;
|
||||
}
|
||||
|
||||
public override DecoderFallbackBuffer CreateFallbackBuffer()
|
||||
{
|
||||
return new InternalDecoderBestFitFallbackBuffer(this);
|
||||
}
|
||||
|
||||
// Maximum number of characters that this instance of this fallback could return
|
||||
public override int MaxCharCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(Object value)
|
||||
{
|
||||
InternalDecoderBestFitFallback that = value as InternalDecoderBestFitFallback;
|
||||
if (that != null)
|
||||
{
|
||||
return (encoding.CodePage == that.encoding.CodePage);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return encoding.CodePage;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class InternalDecoderBestFitFallbackBuffer : DecoderFallbackBuffer
|
||||
{
|
||||
// Our variables
|
||||
internal char cBestFit = '\0';
|
||||
internal int iCount = -1;
|
||||
internal int iSize;
|
||||
private InternalDecoderBestFitFallback _oFallback;
|
||||
|
||||
// Private object for locking instead of locking on a public type for SQL reliability work.
|
||||
private static Object s_InternalSyncObject;
|
||||
private static Object InternalSyncObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_InternalSyncObject == null)
|
||||
{
|
||||
Object o = new Object();
|
||||
Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
|
||||
}
|
||||
return s_InternalSyncObject;
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public InternalDecoderBestFitFallbackBuffer(InternalDecoderBestFitFallback fallback)
|
||||
{
|
||||
_oFallback = fallback;
|
||||
|
||||
if (_oFallback.arrayBestFit == null)
|
||||
{
|
||||
// Lock so we don't confuse ourselves.
|
||||
lock (InternalSyncObject)
|
||||
{
|
||||
// Double check before we do it again.
|
||||
if (_oFallback.arrayBestFit == null)
|
||||
_oFallback.arrayBestFit = fallback.encoding.GetBestFitBytesToUnicodeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback methods
|
||||
public override bool Fallback(byte[] bytesUnknown, int index)
|
||||
{
|
||||
// We expect no previous fallback in our buffer
|
||||
Debug.Assert(iCount < 1, "[DecoderReplacementFallbackBuffer.Fallback] Calling fallback without a previously empty buffer");
|
||||
|
||||
cBestFit = TryBestFit(bytesUnknown);
|
||||
if (cBestFit == '\0')
|
||||
cBestFit = _oFallback.cReplacement;
|
||||
|
||||
iCount = iSize = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Default version is overridden in DecoderReplacementFallback.cs
|
||||
public override char GetNextChar()
|
||||
{
|
||||
// We want it to get < 0 because == 0 means that the current/last character is a fallback
|
||||
// and we need to detect recursion. We could have a flag but we already have this counter.
|
||||
iCount--;
|
||||
|
||||
// Do we have anything left? 0 is now last fallback char, negative is nothing left
|
||||
if (iCount < 0)
|
||||
return '\0';
|
||||
|
||||
// Need to get it out of the buffer.
|
||||
// Make sure it didn't wrap from the fast count-- path
|
||||
if (iCount == int.MaxValue)
|
||||
{
|
||||
iCount = -1;
|
||||
return '\0';
|
||||
}
|
||||
|
||||
// Return the best fit character
|
||||
return cBestFit;
|
||||
}
|
||||
|
||||
public override bool MovePrevious()
|
||||
{
|
||||
// Exception fallback doesn't have anywhere to back up to.
|
||||
if (iCount >= 0)
|
||||
iCount++;
|
||||
|
||||
// Return true if we could do it.
|
||||
return (iCount >= 0 && iCount <= iSize);
|
||||
}
|
||||
|
||||
// How many characters left to output?
|
||||
public override int Remaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return (iCount > 0) ? iCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the buffer
|
||||
[System.Security.SecuritySafeCritical] // overrides public transparent member
|
||||
public override unsafe void Reset()
|
||||
{
|
||||
iCount = -1;
|
||||
}
|
||||
|
||||
// This version just counts the fallback and doesn't actually copy anything.
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal unsafe int InternalFallback(byte[] bytes, byte* pBytes)
|
||||
// Right now this has both bytes and bytes[], since we might have extra bytes, hence the
|
||||
// array, and we might need the index, hence the byte*
|
||||
{
|
||||
// return our replacement string Length (always 1 for InternalDecoderBestFitFallback, either
|
||||
// a best fit char or ?
|
||||
return 1;
|
||||
}
|
||||
|
||||
// private helper methods
|
||||
private char TryBestFit(byte[] bytesCheck)
|
||||
{
|
||||
// Need to figure out our best fit character, low is beginning of array, high is 1 AFTER end of array
|
||||
int lowBound = 0;
|
||||
int highBound = _oFallback.arrayBestFit.Length;
|
||||
int index;
|
||||
char cCheck;
|
||||
|
||||
// Check trivial case first (no best fit)
|
||||
if (highBound == 0)
|
||||
return '\0';
|
||||
|
||||
// If our array is too small or too big we can't check
|
||||
if (bytesCheck.Length == 0 || bytesCheck.Length > 2)
|
||||
return '\0';
|
||||
|
||||
if (bytesCheck.Length == 1)
|
||||
cCheck = unchecked((char)bytesCheck[0]);
|
||||
else
|
||||
cCheck = unchecked((char)((bytesCheck[0] << 8) + bytesCheck[1]));
|
||||
|
||||
// Check trivial out of range case
|
||||
if (cCheck < _oFallback.arrayBestFit[0] || cCheck > _oFallback.arrayBestFit[highBound - 2])
|
||||
return '\0';
|
||||
|
||||
// Binary search the array
|
||||
int iDiff;
|
||||
while ((iDiff = (highBound - lowBound)) > 6)
|
||||
{
|
||||
// Look in the middle, which is complicated by the fact that we have 2 #s for each pair,
|
||||
// so we don't want index to be odd because it must be word aligned.
|
||||
// Also note that index can never == highBound (because diff is rounded down)
|
||||
index = ((iDiff / 2) + lowBound) & 0xFFFE;
|
||||
|
||||
char cTest = _oFallback.arrayBestFit[index];
|
||||
if (cTest == cCheck)
|
||||
{
|
||||
// We found it
|
||||
Debug.Assert(index + 1 < _oFallback.arrayBestFit.Length,
|
||||
"[InternalDecoderBestFitFallbackBuffer.TryBestFit]Expected replacement character at end of array");
|
||||
return _oFallback.arrayBestFit[index + 1];
|
||||
}
|
||||
else if (cTest < cCheck)
|
||||
{
|
||||
// We weren't high enough
|
||||
lowBound = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We weren't low enough
|
||||
highBound = index;
|
||||
}
|
||||
}
|
||||
|
||||
for (index = lowBound; index < highBound; index += 2)
|
||||
{
|
||||
if (_oFallback.arrayBestFit[index] == cCheck)
|
||||
{
|
||||
// We found it
|
||||
Debug.Assert(index + 1 < _oFallback.arrayBestFit.Length,
|
||||
"[InternalDecoderBestFitFallbackBuffer.TryBestFit]Expected replacement character at end of array");
|
||||
return _oFallback.arrayBestFit[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Char wasn't in our table
|
||||
return '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user