File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed
Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <TargetFramework >netcoreapp3.1</TargetFramework >
5- <PackageVersion >1.0.0-preview.3 </PackageVersion >
5+ <PackageVersion >1.0.0</PackageVersion >
66 <Title >Magic File Encoding</Title >
77 <Authors >Jan Schwien</Authors >
88 <Copyright >by Jan Schwien</Copyright >
99 <PackageProjectUrl >https://github.com/Jan5366x/MagicFileEncoding</PackageProjectUrl >
1010 <PackageLicenseUrl >https://github.com/Jan5366x/MagicFileEncoding/blob/master/LICENCE.txt</PackageLicenseUrl >
1111 <RepositoryUrl >https://github.com/Jan5366x/MagicFileEncoding</RepositoryUrl >
12- <PackageReleaseNotes >Alpha Release</PackageReleaseNotes >
12+ <PackageReleaseNotes ></PackageReleaseNotes >
13+ <PackageTags >encoding, text</PackageTags >
1314 </PropertyGroup >
1415
15- <ItemGroup >
16- <PackageReference Include =" System.Text.Encoding.CodePages" Version =" 4.7.1" />
17- </ItemGroup >
18-
1916</Project >
Original file line number Diff line number Diff line change @@ -6,27 +6,32 @@ Be aware of possible transformation issues if the target encoding is more simple
66
77It is strongly recommended to write unit tests for your use case to ensure the load and transformation works as expected.
88
9- ### Nuget Package
9+ ## Nuget Package
1010[ MagicFileEncoding at nuget.org] ( https://www.nuget.org/packages/MagicFileEncoding/ )
1111
12- ### Usage (Preview Version)
12+ ## Usage
1313
14+ #### Read a text file
1415``` csharp
15- // read a text file
16- var mfe = new global ::MagicFileEncoding .MagicFileEncoding ();
17- var str = mfe .AutomaticReadAllText (filename );
16+ new FileEncoding ().AutomaticReadAllText (filename );
1817```
18+ #### Write a text file
1919``` csharp
2020// write a text file
21- var mfe = new global ::MagicFileEncoding .MagicFileEncoding ();
22- _mfe .WriteAllText (tmpFile .Path , text , Encoding .UTF8 );
21+ new FileEncoding ().WriteAllText (tmpFile .Path , text , Encoding .UTF8 );
2322```
24- ### Fallback Encoding
23+ #### Change fallback (default) encoding
24+ ``` csharp
25+ var fe = new cFileEncoding ();
26+ fe .FallbackEncoding = Encoding .Unicode ;
27+ var str = fe .AutomaticReadAllText (filename );
28+ ```
29+ ## Fallback Encoding
2530The fallback encoding is ISO-8859-1 (Latin-1) by default but can be changed via property.
2631
2732(Because this lib was designed for the german culture space)
2833
29- # Credits
34+ ## Credits
3035This work is heavily based on the following stack overflow articles:<br />
3136[ effective-way-to-find-any-files-encoding] ( https://stackoverflow.com/questions/3825390/effective-way-to-find-any-files-encoding ) <br />
3237[ determine-a-strings-encoding-in-c-sharp] ( https://stackoverflow.com/questions/1025332/determine-a-strings-encoding-in-c-sharp ) <br />
Original file line number Diff line number Diff line change 1010 <PackageReference Include =" nunit" Version =" 3.12.0" />
1111 <PackageReference Include =" NUnit3TestAdapter" Version =" 3.15.1" />
1212 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.4.0" />
13- <PackageReference Include =" System.Text.Encoding.CodePages" Version =" 4.7.1" />
1413 </ItemGroup >
1514
1615 <ItemGroup >
You can’t perform that action at this time.
0 commit comments